17. 核心技术
Data Binding
3. BindingUtil
BindingUtils.bindProperty(txtInputB, "text",
txtInputA, "text");
18. 核心技术
Data Binding
4. ChangeWatcher
var watcher:ChangeWatcher = ChangeWatcher.watch(person,
"firstName", onWatcher);
private function onWatcher(evt:PropertyChangeEvent):void {
firstNameId.text = evt.newValue.toString();
}
...
//当你要停止绑定时,手动调用
watcher.unwatch();
19. 核心技术
Data Binding
5.Two Way Binding
//仅需在绑定符号{}外加上@符号即可
<s:TextInput id="txtInputB" text="@{txtInputA.text}"/>
//或者
//在<Binding/>标签中指定twoWay为true即
<fx:Binding source="txtInputA.text"
destination="txtInputB.text" twoWay="true"/>
20. 核心技术
Data Binding
6. [Bindable]
[Bindable]
public var person:Person = new Person();
[Bindable(event="customEvent")]
public function get person():Person {
return _person;
}
在类前使用绑定元标签
......
21. 核心技术
Data Binding
数据绑定机制背后的故事
添加相应的编译参数“-keep”或“-keep-generated-actionscript”
并观察编译器自动生成的中间AS3代码
45. 组件开发
?
LifeCycle ?
?
?
LIFE
通常在invalidation阶段提出请求,在validation阶段完成请求
46. 组件开发
LifeCycle // Create a Group container.
var groupContainer:Group = new Group();
// Configure the Group container.
groupContainer.x = 10;
groupContainer.y = 10;
// Create a Button control.
var b:Button = new Button()
// Configure the button control.
b.label = "Submit";
...
// Add the Button control to the Box
container.
groupContainer.addElement(b);
47. 组件开发
LifeCycle
// Create a Button control.
var b:Button = new Button()
调用:
BRITH Constructor
49. 组件开发
LifeCycle
// Add the Button control to the
Box container.
gropContainer.addElement(b);
BRITH
preinitialize
initial
http://help.adobe.com/en_US/?ex/using/WS460ee381960520ad-2811830c121e9107ecb-7fff.html
60. 资源推荐
Link A brief overview of the Spark architecture and component set
http://www.adobe.com/devnet/?ex/articles/?ex4_sparkintro.html
Flex 4 Component Lifecycle
http://weblog.mrinalwadhwa.com/2009/06/21/?ex-4-component-lifecycle/
Elastic RaceTrack
http://www.craftymind.com/2008/04/18/updated-elastic-racetrack-for-?ash-9-and-avm2/
Using Flex4 - Custom components
http://help.adobe.com/en_US/?ex/using/WS4bebcd66a74275c35bf45738120d4f86190-8000.html
《Flex公司级应用 发最佳实践》 ... 写作中