rocky的空间

« 前页 | 首页
Wednesday Sep 01, 2010

应用程序向导

In the previous four modules, you learned to create, debug and deploy a Flex application. In this module, you'll learn how to change the appearance of the application using styling and skinning. With styling, you set component styles inline in MXML or preferably in a style sheet, using selectors. Each component has a limited number of styles defined for it. If you want to change the appearance of a component more drastically than possible with component styles, you need to create or edit the associated component skin, the file specifying what the component should look like. By following the steps below, you'll learn to create a style sheet and to find style rules that you apply to your application. You'll start by creating a style sheet and defining global styles for the application. To do this, you'll need to be in design view, and then select the appearance panel. With the appearance panel selected, you can make changes to the global application styles, such as the font, the text size and then colors used in the application. You'll need to make changes to the chrome color, the selection color, the rollover color and the focus color for the application. Whilst you've been making changes to the global application styles, Flash Builder has created a new TestDrive.css file and referenced it from your application MXML file. You should open up the TestDrive.css file in the Package Explorer to see the code that Flash Builder has written for you. In addition to specifying global application styles, you can also define styles for types of component or individual instances of a component. In this application, we want to change the value for the corner radius of all the buttons. To do this, you'll return to design view and select a button on the design surface. With the button selected, you'll use the properties view to specify the corner radius value. This change will only affect the currently selected button. You'll then need to use the convert to CSS button and in the dialog, select the selector type and specific component. With this applied, Flash Builder will create a new style property in the CSS file that specifies the corner radius for all buttons in the application. Back in design view, you can see the change has been made, and all buttons now have a corner radius of the value 5. To specify additional style properties for the button component, you'll return to the CSS file and make changes to the CSS selector for the button. Here you'll specify the font weight and also the color of the text for the button. After making changes in the CSS file for your application, you'll need to save the file before the changes will show up in Flash Builder's design view. You've now seen how to define global and type CSS styles for your application. By completing the tutorial, you'll also learn about class, pseudo and ID selectors that you can apply to components. In the next tutorial, you'll learn how to change the appearance of a component more drastically by extending a default component skin and adding additional components to it.

在前四个模块中,您学习了怎样创建,调试与配置Flex应用程序。 在这一模块中,您将学习怎样通过造型与皮肤设置来改变应用程序的外观。 在造型设置中,您可以通过选择器来将组件样式内嵌入MXML或者样式表中。 每一个组件都由有限的样式来定义它。 如果您想更彻底的改变组件外观,而不是单纯依靠组件样式,您需要创建或者编辑相关的组件皮肤的文件,这个文件指定了组件的样式。 按照下面的步骤,您将学习怎样创建样式表,并找到您提供给应用程序的样式规则。 您将从创建样式表以及为应用程序定义通用样式开始。 要做到这些,您需要处于设计视图中,然后选择外观面板。 当外观面板被选中以后,您可以改变通用样式,例如应用程序中的字体,字号及文字颜色。 您需要改变应用程序的边框颜色,选择颜色,滚动条颜色以及焦点颜色。 与此同时,您已经改变了通用样式,Flash Builder已经创建了一个新的TestDrive.css文件并从您的应用MXML文件中进行了引用。 您应该打开在Package Explorer中的TestDrive.css文件来查看Flash Builder为您编写的代码。 除了指定通用样式以外,您也可以对组件类型或者组件个别实例的样式进行定义。 在这一应用程序中,我们想要改变所有按钮角半径的数值。 要做到这些,您需要回到设计视图并选择在设计页面的一个按钮。 当这个按钮被选中以后,您将使用属性视图来指定角半径数值。 这一改变只对当前选中的按钮有效。 然后,您需要使用转换为CSS按钮,在对话框中选择选择器类型并指定组件。 这些改变提交以后,Flash Builder将会在CSS文件中创建一个新的样式属性,这一CSS文件指定了应用程序中所有按钮的角半径。 回到设计视图中,您会发现所有按钮的角半径数值都变成了5 如果需要指定按钮组件的额外样式属性,您需要回到CSS文件中改变按钮的CSS选择器。 这里您将指定按钮的字体粗细以及字体颜色。 在改变了应用程序的CSS文件以后,您将需要在这些改变显示在Flash Builder的设计视图以前保存文件。 您现在已经知道了怎样在您的应用程序中定义通用样式以及典型CSS样式。 通过完成本向导,您也可以学习有关类,伪类及ID选择器的知识,而这些选择器均可被添加进组件内。 在下一个向导中,您将学习怎样通过扩展默认组件皮肤以及增加额外组件来更加彻底的改变组件外观。

评论:

To find your favorite team's NFL jerseys just click here:www.stajump.com

发表于 wholesale nfl jerseys 在 2010年09月07日, 03:19 PM CST #

发表一条评论:
  • HTML语法: 启用

日志归档日历

新闻种子设置

搜索网志

链接

导航

引用