﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-robbie-文章分类-Flex2</title><link>http://www.blogjava.net/robbie/category/16728.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 10:03:38 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 10:03:38 GMT</pubDate><ttl>60</ttl><item><title>Flex2 develop guide study - 5 - data binding </title><link>http://www.blogjava.net/robbie/articles/79280.html</link><dc:creator>三十而立</dc:creator><author>三十而立</author><pubDate>Sun, 05 Nov 2006 15:14:00 GMT</pubDate><guid>http://www.blogjava.net/robbie/articles/79280.html</guid><wfw:comment>http://www.blogjava.net/robbie/comments/79280.html</wfw:comment><comments>http://www.blogjava.net/robbie/articles/79280.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/robbie/comments/commentRss/79280.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/robbie/services/trackbacks/79280.html</trackback:ping><description><![CDATA[P988<br /><br />Binding data with the &lt;mx:Binding&gt; tag<br /><br />该章节和Binding data with curly braces基本一样，讲了如下几个方面的内容：<br />1、Using ActionScript expressions in Binding tags<br />      在BindingTags中使用ActionScript表达式<br />2、Binding more than one source property to a destination property<br />      将多个源属性绑定到一个目的属性上<br />3、Binding a source property to more than one destination property<br />      将一个源属性绑定到多个目的属性上<br />4、Using an E4X expression in an &lt;mx:Binding&gt; tag<br />      在&lt;mx:Binding&gt;标签中使用E4X表达式<br /><br />上述四种情况在文中都有例子，仔细看一下，理解起来应该没有问题。<br /><br />第三种情况中的例子应该修改为如下，才可以正确运行，在文中的例子中没有&lt;mx:Binding&gt;的相关配置。<br />&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />&lt;mx:Application xmlns:mx="<a href="http://www.adobe.com/2006/mxml">http://www.adobe.com/2006/mxml</a>" layout="absolute"&gt;<br /> &lt;mx:TextInput id="input1" text="Hello" /&gt;<br /> &lt;mx:Model id="mod1"&gt;<br />  &lt;part&gt;{input1.text}&lt;/part&gt;<br /> &lt;/mx:Model&gt;<br /> &lt;mx:Model id="mod2"&gt;<br />  &lt;part&gt;{input1.text}&lt;/part&gt;<br /> &lt;/mx:Model&gt;<br /> &lt;mx:Label id="label1" x="10" y="30" text="{mod1.part}"/&gt;<br /> &lt;mx:Label id="label2" x="10" y="60" text="{mod2.part}"/&gt;<br /> <br /> <font color="#0000ff">&lt;mx:Binding source="input1.text" destination="mod1.part"/&gt;<br /> &lt;mx:Binding source="input1.text" destination="mod2.part"/&gt;<br /> &lt;mx:Binding source="mod1.part" destination="label1.text"/&gt;<br /> &lt;mx:Binding source="mod2.part" destination="label2.text"/&gt;<br /></font>&lt;/mx:Application&gt;<br /><br /><img src ="http://www.blogjava.net/robbie/aggbug/79280.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/robbie/" target="_blank">三十而立</a> 2006-11-05 23:14 <a href="http://www.blogjava.net/robbie/articles/79280.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex2 develop guide study - 4 - data binding </title><link>http://www.blogjava.net/robbie/articles/78812.html</link><dc:creator>三十而立</dc:creator><author>三十而立</author><pubDate>Thu, 02 Nov 2006 16:19:00 GMT</pubDate><guid>http://www.blogjava.net/robbie/articles/78812.html</guid><wfw:comment>http://www.blogjava.net/robbie/comments/78812.html</wfw:comment><comments>http://www.blogjava.net/robbie/articles/78812.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/robbie/comments/commentRss/78812.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/robbie/services/trackbacks/78812.html</trackback:ping><description><![CDATA[
		<p>P986<br /><br />Using ActionScript expressions in curly braces<br />在{}中使用ActionScript表达式<br /><br />Using an E4X expression in curly braces<br />在{}中使用E4X表达式<br /><br />A binding expression in curly braces or an &lt;mx:Binding&gt; tag can contain an ECMAScript for<br />XML (E4X) expression when the source of a binding is a bindable property of type XML.<br />当绑定的属性是XML类型时，在{}中的绑定表达式或者在&lt;mx:Binding&gt;标签中可以包含一个ECMAScript for XML的表达式。<br /><br /><font color="#0000ff">当使用E4X表达式时，必须对XML熟悉。</font><br /><br /><font color="#ff0000">P987页的例子应该试一下，看看当xml中有两个description时，其输出结果会如何？<br /></font>当有两个description时，会迭代将description输出，不过需要注意的是输出结果格式如下：<br />   <font color="#0000ff">&lt;description&gt;Big Screen Television&lt;/description&gt;<br />   &lt;description&gt;DVD Player&lt;/description&gt;<br /></font><br />Using ActionScript functions in curly braces<br />在{}中使用ActionScript函数<br /><br />If the inString property is not passed as an argument, but is referenced from within the<br />function, the function does not get invoked when the inString property changes.<br />如果inString属性没有作为参数进行传递，而是在函数内部被引用了，当inString属性发生变化时，函数是不会被调用的。<br /><br />以上三种情况的例子在文档中有详细的描述，就不在这里贴出了。<br /><br />最近忙于项目上线，只能每天少看一点了：（</p>
<img src ="http://www.blogjava.net/robbie/aggbug/78812.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/robbie/" target="_blank">三十而立</a> 2006-11-03 00:19 <a href="http://www.blogjava.net/robbie/articles/78812.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex2 develop guide study - 3 - data binding</title><link>http://www.blogjava.net/robbie/articles/78570.html</link><dc:creator>三十而立</dc:creator><author>三十而立</author><pubDate>Wed, 01 Nov 2006 15:06:00 GMT</pubDate><guid>http://www.blogjava.net/robbie/articles/78570.html</guid><wfw:comment>http://www.blogjava.net/robbie/comments/78570.html</wfw:comment><comments>http://www.blogjava.net/robbie/articles/78570.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/robbie/comments/commentRss/78570.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/robbie/services/trackbacks/78570.html</trackback:ping><description><![CDATA[P984<br />Data binding requires a source property, a destination property, and a triggering event that<br />indicates when to copy the data from the source to the destination.<br /><br />数据绑定需要一个源，一个目标和需要从源拷贝数据到目的一个触发事件。<br /><font color="#3333cc"><br /><font style="BACKGROUND-COLOR: #ffffff" color="#0000ff">注意：这句话解释了数据绑定的本质。也引出了下面的一段话。</font><br /><br /></font><font color="#000000">You can use all properties of a component as the destination of a data binding expression.<br />However, to use a property as the source of a data binding expression,<font color="#0000cc"></font><font color="#0000ff"><u>the component must be<br />implemented to support data binding, which means that the component dispatches an event<br />when the value of the property changes to trigger the binding</u>.</font> For more information on<br />creating component properties that can be used as the source of a data binding expression, see<br />“Bindable metadata tag” in Creating and Extending Flex 2 Components.<br /><br />上面这段话的关键含义在于有下划线的这一段: 控件必须支持数据绑定，这意味着当属性改变时控件必须发送一个事件来触发数据绑定的操作。<br /><br />In addition to properties, you can use ActionScript functions as the source of binding<br />expressions. You usually do this when using a bindable property as an argument of a function.<br />When the property changes, the function executes, and the result is used in the binding<br />destination.<br /><br />对于实行，可以使用ActionScript的函数做为绑定表达式的源。通常可以使用一个绑定的属性做为函数的参数，这样当属性变化时，函数将会执行，结果就会被绑定的目的使用。<br /><br /><font color="#0000ff">注：对上面一段话有了初步的理解，不过最好能有一个例子说明，可惜还没看到:(</font><br /><br />You can also use a property of type Function as a binding source or destination. A property of<br />type Function is a variable that holds a reference to a function.<br /><br /><font color="#0000ff">注：这也是一个说明函数与数据绑定相关的使用方法。<br /></font><font color="#0000ff">下面终于就要讲到数据绑定的具体使用方法了。<br /></font><br /><font size="5">Binding data with curly braces<br /></font><br />举例如下：<br />&lt;?xml version="1.0"?&gt;<br />&lt;mx:Application xmlns:mx="<a href="http://www.adobe.com/2006/mxml">http://www.adobe.com/2006/mxml</a>"&gt;<br />&lt;!-- Data model stores registration data that user enters. --&gt;<br />&lt;mx:Model id="reg"&gt;<br />   &lt;registration&gt;<br />      &lt;name&gt;{name.text}&lt;/name&gt;<br />      &lt;email&gt;{email.text}&lt;/email&gt;<br />      &lt;phone&gt;{phone.text}&lt;/phone&gt;<br />      &lt;zip&gt;{zip.text}&lt;/zip&gt;<br />      &lt;ssn&gt;{ssn.text}&lt;/ssn&gt;<br />   &lt;/registration&gt;<br />&lt;/mx:Model&gt;<br />&lt;!-- Form contains user input controls. --&gt;<br />&lt;mx:Form&gt;<br />   &lt;mx:FormItem label="Name" required="true"&gt;<br />      &lt;mx:TextInput id="name" width="200"/&gt;<br />   &lt;/mx:FormItem&gt;<br />   &lt;mx:FormItem label="Email" required="true"&gt;<br />      &lt;mx:TextInput id="email" width="200"/&gt;<br />   &lt;/mx:FormItem&gt;<br />   &lt;mx:FormItem label="Phone" required="true"&gt;<br />      &lt;mx:TextInput id="phone" width="200"/&gt;<br />   &lt;/mx:FormItem&gt;<br />   &lt;mx:FormItem label="Zip" required="true"&gt;<br />      &lt;mx:TextInput id="zip" width="60"/&gt;<br />   &lt;/mx:FormItem&gt;<br />   &lt;mx:FormItem label="Social Security" required="true"&gt;<br />      &lt;mx:TextInput id="ssn" width="200"/&gt;<br />   &lt;/mx:FormItem&gt;<br />   ...<br />&lt;/mx:Form&gt;<br />&lt;/mx:Application&gt;<br /><br />上面的例子很清楚的说明了使用{}做为数据绑定的用法。不过在上面的例子中使用到了DataModel，关于Data Models请参见 Chapter 38, “Storing Data,” on page 1001。</font><img src ="http://www.blogjava.net/robbie/aggbug/78570.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/robbie/" target="_blank">三十而立</a> 2006-11-01 23:06 <a href="http://www.blogjava.net/robbie/articles/78570.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex2 develop guide study - 2</title><link>http://www.blogjava.net/robbie/articles/78249.html</link><dc:creator>三十而立</dc:creator><author>三十而立</author><pubDate>Tue, 31 Oct 2006 04:52:00 GMT</pubDate><guid>http://www.blogjava.net/robbie/articles/78249.html</guid><wfw:comment>http://www.blogjava.net/robbie/comments/78249.html</wfw:comment><comments>http://www.blogjava.net/robbie/articles/78249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/robbie/comments/commentRss/78249.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/robbie/services/trackbacks/78249.html</trackback:ping><description><![CDATA[P983<br />About data binding<br /><br />Data binding is the process of tying the data in one object to another object. It provides a<br />convenient way to pass data around in an application. Adobe Flex 2 provides three ways to<br />specify data binding: the curly braces ({}) syntax and the &lt;mx:Binding&gt; tag in MXML and<br />the BindingUtils methods in ActionScript.<br /><br />数据绑定提供了一种便利的方法在程序中传递数据，它可以在一个对象和另一个对象间建立关联关系。在Flex2中提供了三种特定的方法用于数据绑定：<br />1、{}<br />2、&lt;mx:Binding&gt;标签<br />3、ActionScript中的BindingUtils方法<br /><br />Common uses of data binding include the following:<br />通常使用数据绑定的情形如下：<br />■ To bind properties of user interface controls to data service requests.<br />将用户交互界面中的输入绑定到数据服务请求中。<br />■ To bind data service results to properties of user interface controls.<br />将数据服务响应的结果绑定到用户交互界面中。<br />■ To bind data service results to a middle-tier data model, and to bind that data model’s<br />fields to user interface controls. For more information about data models, see Chapter 38,<br />“Storing Data,” on page 1001.<br />将数据服务响应结果绑定到处于中间层的数据模型中，再将数据模型的字段绑定到用户交互界面中。<br />■ To bind properties of user interface controls to a middle-tier data model, and to bind that<br />data model’s fields bound to a data service request (a three-tier system).<br />984 Binding Data<br />将用户交互界面中的输入绑定到处于中间层的数据模型中，再将数据模型的字段绑定到数据服务请求中。<br />■ To bind an ArrayCollection or XMLListCollection object to the dataProvider property<br />of a List-based control.<br />将ArrayCollection或者XMLListCollection对象绑定到基于List的界面控件的dataProvider属性中。<br />■ To bind individual parts of complex properties to properties of user interface controls. An<br />example would be a master-detail scenario in which clicking an item in a List control<br />displays data in several other controls.<br />将复杂属性的单个部分绑定到用户交互界面中。<br />■ To bind XML data to user interface controls by using ECMAScript for XML (E4X)<br />expressions in binding expressions.<br />通过使用ECMAScript for XML表达式将XML数据绑定到用户交互界面中。<br /><br />Although binding is a powerful mechanism, it is not appropriate for all situations. For<br />example, for a complex user interface in which individual pieces must be updated based on<br />strict timing, it would be preferable to use a method that assigns properties in order. Also,<br />binding executes every time a property changes, so it is not the best solution when you want<br />changes to be noticed only some of the time.<br /><br />尽管数据绑定是一个强大的机制，但是其并不适用于所有状况。比如在如下两种情况中就不适合使用数据绑定：<br />1、在一个复杂的用户交互界面中，一些更新有严格的时间次序。<br />2、由于数据绑定在属性每次发生改变时都会触发，仅仅希望在一些特定的条件下触发改变时就不适合使用数据绑定。<br /><br /><br /><br /><img src ="http://www.blogjava.net/robbie/aggbug/78249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/robbie/" target="_blank">三十而立</a> 2006-10-31 12:52 <a href="http://www.blogjava.net/robbie/articles/78249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex2 develop guide study - 1</title><link>http://www.blogjava.net/robbie/articles/78176.html</link><dc:creator>三十而立</dc:creator><author>三十而立</author><pubDate>Mon, 30 Oct 2006 15:26:00 GMT</pubDate><guid>http://www.blogjava.net/robbie/articles/78176.html</guid><wfw:comment>http://www.blogjava.net/robbie/comments/78176.html</wfw:comment><comments>http://www.blogjava.net/robbie/articles/78176.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/robbie/comments/commentRss/78176.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/robbie/services/trackbacks/78176.html</trackback:ping><description><![CDATA[
		<p>
				<img height="1" src="/WebResource.axd?d=pLXXeGbWF7eXU8SMs2-GFZvUWY2JNH05dFx5YzJhGUYAYJAFEaTEq36NAhTPy7_KekvzDFwt8wvQWdByvJIGWdEq6x2KpKD80&amp;t=632785713320000000" width="1" align="center" />P980<br />Representing Data<br /><br /><img height="744" alt="RepresentingData.JPG" src="http://www.blogjava.net/images/blogjava_net/robbie/RepresentingData.JPG" width="579" align="right" border="0" /><br />Data binding<br />The data binding feature provides a syntax for automatically copying the value of a property<br />of one client-side object to a property of another object at run time. Data binding is usually<br />triggered when the value of the source property changes. You can use data binding to pass user<br />input data from user interface controls to a data service. You can also use data binding to pass<br />results returned from a data service to user interface controls.<br /><br />数据绑定特性可以在运行时自动将一个客户端对象的属性复制到另一个客户端对象的属性。数据绑定通常当一个原对象的属性改变时被触发。你可以使用数据绑定将用户输入数据传递至数据服务端。你也可以使用数据绑定将数据服务端的返回值传递至用户交互界面。<br /><br />Data models<br />The data model feature lets you store data in client-side objects. A data model is an<br />ActionScript object that contains properties for storing data, and that optionally contains<br />methods for additional functionality. Data models are useful for partitioning the user interface<br />and data in an application.</p>
		<p>数据模型特性可以将数据存储于客户端，一个数据模型是一个ActionScript对象，这个对象的属性与要存储的数据对应，这个对象也可能包含一些其它方法。数据模型对于将程序中的用户交互界面与数据分离非常有效。<br /><br />Data validation<br />The data validation feature lets you ensure that data meets specific criteria before the<br />application uses the data.<br /><br />数据校验特性使得程序在使用数据前，确保数据符合一定的标准。<br /><br />Data formatting<br />The data formatting feature lets you change the format of data before displaying it in a user<br />interface control.<br /><br />数据格式特性使得在将数据显示于用户交互界面前可以改变数据的显示格式。</p>
<img src ="http://www.blogjava.net/robbie/aggbug/78176.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/robbie/" target="_blank">三十而立</a> 2006-10-30 23:26 <a href="http://www.blogjava.net/robbie/articles/78176.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>