<?xml version="1.0"?>
<!-- binding/FontPropertyBinding.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<fx:Script>
<![CDATA[
// Define public vars for tracking font size.
[Bindable]
public var maxFontSize:Number = 15;
[Bindable]
public var minFontSize:Number = 5;
]]>
</fx:Script>
<s:Label text="{maxFontSize}"/>
<s:Label text="{minFontSize}"/>
<s:Button click="maxFontSize=20; minFontSize=10;"/>
</s:Application>
数据绑定 能自动地将值给目标属性。
开始时,上述两个标签分别值显示为15和5,当点击按钮时,则自动变成了20,10