Flex数据绑定相关内容

0.Flex数据绑定中难以发现的无声错误
[url]http://developer.51cto.com/art/201007/214579.htm[/url]1.数据绑定的几种方式
[url]http://www.flashas.net/flex/20100416/5231.html[/url]

[url]http://developer.51cto.com/art/201007/214588.htm[/url]
2.Flex数据绑定大全
[url]http://vipnews.csdn.net/newscontent.aspx?pointid=2010_08_26_160732962[/url]
3.双向绑定
[url]http://www.doriandeng.com/archives/191.html[/url]


<?xml version="1.0"?>
<!-- binding/BasicBinding.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:TextInput id="myTI" text="Enter text here"/>
<mx:Text id="myText" text="{myTI.text}"/>
</mx:Application>


<?xml version="1.0"?>   
<!-- binding/BasicBindingMXML.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:TextInput id="myTI"/>
<mx:Text id="myText"/>

<mx:Binding source="myTI.text" destination="myText.text"/>
</mx:Application>



<?xml version="1.0"?>   
<!-- binding/BasicBindingAS.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
<![CDATA[
import mx.binding.utils.*;

// Define data binding.
public function initBindingHandler():void {
BindingUtils.bindProperty(myText, "text", myTI, "text");
}
]]>
</mx:Script>

<mx:TextInput id="myTI"/>
<mx:Text id="myText" preinitialize="initBindingHandler();"/>
</mx:Application>



<?xml version="1.0"?>   
<!-- binding/FontPropertyBinding.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
<![CDATA[
// Define public vars for tracking font size.
[Bindable]
public var maxFontSize:Number = 15;

[Bindable]
public var minFontSize:Number = 5;
]]>
</mx:Script>

<mx:Text text="{maxFontSize}"/>
<mx:Text text="{minFontSize}"/>

<mx:Button click="maxFontSize=20; minFontSize=10;"/>
</mx:Application>


4.双向绑定
[url]http://bbs.seehuu.com/archiver/?tid-430.html[/url]
FLEX双向数据绑定
Flex中一个很有用的功能是数据的绑定,比如我们有属性a,以及输入框b,我们可以把属性a与输入框b绑定起来,这样
改变a的值时,输入框b的值也会相应变化。这种绑定是单项的。在Flex SDK4以前没有直接的双向绑定,所以当我们想
反过来通过设置b的值来改变a时就会比较麻烦。而Flex4为我们提供了双向绑定的方法,下面我们来举个例子。
场景中有t1与t2两个输入框,无论我们改变哪一个输入框的值,另一个都会跟着变化。
<s:TextInput id="t1" text="@{t2.text}" />
<s:TextInput id="t2" />
代码中的text="@{t2.text}"就实现了双向绑定。下面是另一个双向绑定的方法
<fx:Binding source="input1.text" destination="input2.text" twoWay="true"/>
twoWay="true"表示双向绑定。
同学们要注意在样式,特效,数据服务以及远程对象的使用时是不能使用双向绑定的。

5.数据绑定的几种情况
http://developer.51cto.com/art/201008/218597.htm
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值