FLEX K
导入源程序到SRC目录,新建EXAMPLE项目,PASTE一些新的组件,AFTER RUN容易理解这些CHAT图表组件,FLASH绘图已经封装得比较完美,关键还是数据源,AMFPHP或是LIVECYCLE BLAZE DS的服务器端编程,达到和FLASH通信的目的;
Changing the Flex default properties
Every Flex application defines the default Application container—this is the root element,
within which everything else is defined. The Application container has some
default layout characteristics and style properties that define the look and feel of an application
(which can be modified).
the default Application container—this is the root element,
每FLEX应用定义特定的默认容器,这是Root element, 在其中定义别的元素, Application Container有布局和其它的属性定义外观,并且是可以被修改的.
在容器里面直接定义多个样式,比如background-Color:white;horizontalAlign;horizontalAlign; etc,
To obtain a solid color, avoiding the fading effect, set the backgroundAlpha property to 0:
In the project, create a new folder called assets. In this folder, insert an image in one of the formats supported by Flex.
It is useful to use this property when you want to overwrite all the default styles and define personalized styles--------------styleName;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
In the global selector, the font family, the font dimension, the weight, the style, and the textDecoration are defined. All the properties declared in the global—even the noninheritable ones—are applied to the application.
Using the data binding
data binding,数据绑定比较常用在开发中;
- Using the curly braces syntax {}
- With the <mx:Binding> tag defined in the MXML code
- By declaring the BindingUtils method with ActionScript
One of the features of Flex that you will use frequently during the development phase of
an application is data binding, which is the process that binds a data object to a component so the latter becomes automatically added when the value to which it is bound changes. In Flex there are three methods to create a data binding:
EXPERT POINT:
Unlike with the curly braces syntax, the use of the <mx:Binding> tag enables you to clearly
separate the user interface from the data model and to apply different source properties
不同于{}语法,<mx:Binding>标签能清楚地分离开用户界面和数据model,轻易地应用不同的属性到不同的目的地;
The use of the BindingUtils class enables you to create and handle the data bindings in a separate ActionScript class that can be applied across different project.
The data binding method you choose obviously depends on the situation.
数据绑定方法的选择,完全依据形势;
Handling keyboard events
与传统WEB程序形成对比,FLEX应用程序经常响应键盘的处理,它们类似桌面应用程序,用户为了最快激活功能,快速从一个文档一个地方到另一块,常用键盘快捷键;
From the simple closure of a pop-up window, to the activation of a video player or help window, Flash Player enables you to manage keyboard events, and you’ll investigate them in this solution.
At its core, the Flex framework comes with many components and a flexible architecture
you can customize and extend by using the ActionScript 3 programming language.
This chapter discussed how to customize the surface of the Flex applications by using CSS.
Then you made use of one of the coolest Flex features: the data binding process. Flex
binds a data object to a component so that the latter becomes automatically added when
the value to which it is bound changes (unlike other programming languages, in which you
have to write all the code to reproduce this process!). With Flex this feature is built in and
ready to use.
To know when something has happened in the application, you need to use the Flex event
model. This chapter illustrated how the Flex event model works and how to use the event
object to register event listener functions or react to keyboard events.
The solutions in this chapter have just given you a taste for just what’s possible with the
Flex framework. In Chapter 2 you’ll discover the power of Flex components.