ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>热久久久久久,欧美综合二区,国产日韩精品在线看http://www.aygfsteel.com/robbie/category/16728.htmlzh-cnTue, 27 Feb 2007 10:03:38 GMTTue, 27 Feb 2007 10:03:38 GMT60Flex2 develop guide study - 5 - data binding http://www.aygfsteel.com/robbie/articles/79280.html三十而立三十而立Sun, 05 Nov 2006 15:14:00 GMThttp://www.aygfsteel.com/robbie/articles/79280.htmlhttp://www.aygfsteel.com/robbie/comments/79280.htmlhttp://www.aygfsteel.com/robbie/articles/79280.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/79280.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/79280.html
Binding data with the <mx:Binding> tag

该章节和Binding data with curly bracesåŸºæœ¬ä¸€æ øP¼Œè®²äº†(ji¨£n)如下几个斚w¢çš„内容:(x¨¬)
1、Using ActionScript expressions in Binding tags
      在BindingTags中ä‹É用ActionScript表达å¼?br />2、Binding more than one source property to a destination property
      ž®†å¤šä¸ªæºå±žæ€§ç»‘定到一个目的属性上
3、Binding a source property to more than one destination property
      ž®†ä¸€ä¸ªæºå±žæ€§ç»‘定到多个目的属性上
4、Using an E4X expression in an <mx:Binding> tag
      åœ?lt;mx:Binding>标签中ä‹É用E4X表达å¼?br />
上述四种情况在文中都有例子,仔细看一下,理解èµäh¥åº”该没有问题ã€?br />
½W¬ä¸‰¿Uæƒ…å†µä¸­çš„ä¾‹å­åº”è¯¥ä¿®æ”¹äØ“(f¨´)如下åQŒæ‰å¯ä»¥æ­£ç¡®˜qè¡ŒåQŒåœ¨æ–‡ä¸­çš„例子中没有<mx:Binding>的相关配¾|®ã€?br /><?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" <mx:TextInput id="input1" text="Hello" />
 <mx:Model id="mod1">
  <part>{input1.text}</part>
 </mx:Model>
 <mx:Model id="mod2">
  <part>{input1.text}</part>
 </mx:Model>
 <mx:Label id="label1" x="10" y="30" text="{mod1.part}"/>
 <mx:Label id="label2" x="10" y="60" text="{mod2.part}"/>
 
 <mx:Binding source="input1.text" destination="mod1.part"/>
 <mx:Binding source="input1.text" destination="mod2.part"/>
 <mx:Binding source="mod1.part" destination="label1.text"/>
 <mx:Binding source="mod2.part" destination="label2.text"/>
</mx:Application>



]]>
Flex2 develop guide study - 4 - data binding http://www.aygfsteel.com/robbie/articles/78812.html三十而立三十而立Thu, 02 Nov 2006 16:19:00 GMThttp://www.aygfsteel.com/robbie/articles/78812.htmlhttp://www.aygfsteel.com/robbie/comments/78812.htmlhttp://www.aygfsteel.com/robbie/articles/78812.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/78812.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/78812.htmlP986

Using ActionScript expressions in curly braces
在{}中ä‹É用ActionScript表达å¼?br />
Using an E4X expression in curly braces
在{}中ä‹É用E4X表达å¼?br />
A binding expression in curly braces or an <mx:Binding> tag can contain an ECMAScript for
XML (E4X) expression when the source of a binding is a bindable property of type XML.
当绑定的属性是XML¾cÕdž‹æ—Óž¼Œåœ¨{}中的¾l‘定表达式或者在<mx:Binding>标签中可以包含一个ECMAScript for XML的表辑ּã€?br />
当ä‹É用E4X表达式时åQŒå¿…™åÕd¯¹XML熟æ?zh¨¨n)‰ã€?/font>

P987™å늚„例子应该试一下,看看当xml中有两个descriptionæ—Óž¼Œå…¶è¾“出结果会(x¨¬)如何åQ?br />当有两个descriptionæ—Óž¼Œä¼?x¨¬)è„P代将description输出åQŒä¸˜q‡éœ€è¦æ³¨æ„çš„æ˜¯è¾“出结果格式如下:(x¨¬)
   <description>Big Screen Television</description>
   <description>DVD Player</description>

Using ActionScript functions in curly braces
在{}中ä‹É用ActionScript函数

If the inString property is not passed as an argument, but is referenced from within the
function, the function does not get invoked when the inString property changes.
如果inString属性没有作为参数进行传递,而是在函数内部被引用äº?ji¨£n),当inString属性发生变化时åQŒå‡½æ•°æ˜¯ä¸ä¼š(x¨¬)被调用的ã€?br />
以上三种情况的例子在文档中有详细的描˜qŽÍ¼Œž®×ƒ¸åœ¨è¿™é‡Œè„“(chu¨¤ng)å‡ÞZº†(ji¨£n)ã€?br />
最˜q‘忙于项目上¾U¿ï¼Œåªèƒ½æ¯å¤©ž®‘看一点了(ji¨£n)åQšï¼ˆ



]]>
Flex2 develop guide study - 3 - data bindinghttp://www.aygfsteel.com/robbie/articles/78570.html三十而立三十而立Wed, 01 Nov 2006 15:06:00 GMThttp://www.aygfsteel.com/robbie/articles/78570.htmlhttp://www.aygfsteel.com/robbie/comments/78570.htmlhttp://www.aygfsteel.com/robbie/articles/78570.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/78570.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/78570.htmlData binding requires a source property, a destination property, and a triggering event that
indicates when to copy the data from the source to the destination.

数据¾l‘定需要一个源åQŒä¸€ä¸ªç›®æ ‡å’Œéœ€è¦ä»Žæºæ‹·è´æ•°æ®åˆ°ç›®çš„一个触发事件ã€?br />
注意åQšè¿™å¥è¯è§£é‡Šäº?ji¨£n)数据绑定的本质。也引出äº?ji¨£n)下面的一ŒDµè¯ã€?/font>

You can use all properties of a component as the destination of a data binding expression.
However, to use a property as the source of a data binding expression,the component must be
implemented to support data binding, which means that the component dispatches an event
when the value of the property changes to trigger the binding
.
For more information on
creating component properties that can be used as the source of a data binding expression, see
“Bindable metadata tag�in Creating and Extending Flex 2 Components.

上面˜q™æ®µè¯çš„关键含义在于有下划线的这一ŒD? 控äšg必须支持数据¾l‘定åQŒè¿™æ„å‘³ç€å½“属性改变时控äšg必须发送一个事件来触发数据¾l‘定的操作ã€?br />
In addition to properties, you can use ActionScript functions as the source of binding
expressions. You usually do this when using a bindable property as an argument of a function.
When the property changes, the function executes, and the result is used in the binding
destination.

对于实行åQŒå¯ä»¥ä‹É用ActionScript的函数做为绑定表辑ּçš„æºã€‚通常可以使用一个绑定的属性做为函数的参数åQŒè¿™æ ·å½“属性变化时åQŒå‡½æ•°å°†ä¼?x¨¬)执行,¾l“æžœž®×ƒ¼š(x¨¬)被绑定的目的使用ã€?br />
注:(x¨¬)对上面一ŒDµè¯æœ‰äº†(ji¨£n)初步的理解,不过最好能有一个例子说明,可惜˜q˜æ²¡çœ‹åˆ°:(

You can also use a property of type Function as a binding source or destination. A property of
type Function is a variable that holds a reference to a function.

注:(x¨¬)˜q™ä¹Ÿæ˜¯ä¸€ä¸ªè¯´æ˜Žå‡½æ•îC¸Žæ•°æ®¾l‘定相关的ä‹É用方法ã€?br />下面¾lˆäºŽž®Þp¦è®²åˆ°æ•°æ®¾l‘定的具体ä‹É用方法了(ji¨£n)ã€?br />
Binding data with curly braces

举例如下åQ?br /><?xml version="1.0"?>
<mx:Application xmlns:mx="<!-- Data model stores registration data that user enters. -->
<mx:Model id="reg">
   <registration>
      <name>{name.text}</name>
      <email>{email.text}</email>
      <phone>{phone.text}</phone>
      <zip>{zip.text}</zip>
      <ssn>{ssn.text}</ssn>
   </registration>
</mx:Model>
<!-- Form contains user input controls. -->
<mx:Form>
   <mx:FormItem label="Name" required="true">
      <mx:TextInput id="name" width="200"/>
   </mx:FormItem>
   <mx:FormItem label="Email" required="true">
      <mx:TextInput id="email" width="200"/>
   </mx:FormItem>
   <mx:FormItem label="Phone" required="true">
      <mx:TextInput id="phone" width="200"/>
   </mx:FormItem>
   <mx:FormItem label="Zip" required="true">
      <mx:TextInput id="zip" width="60"/>
   </mx:FormItem>
   <mx:FormItem label="Social Security" required="true">
      <mx:TextInput id="ssn" width="200"/>
   </mx:FormItem>
   ...
</mx:Form>
</mx:Application>

上面的例子很清楚的说明了(ji¨£n)使用{}åšäØ“(f¨´)数据¾l‘定的用法。不˜q‡åœ¨ä¸Šé¢çš„例子中使用åˆîCº†(ji¨£n)DataModelåQŒå…³äºŽData Models请参见 Chapter 38, “Storing Data,â€?on page 1001ã€?/font>

]]>
Flex2 develop guide study - 2http://www.aygfsteel.com/robbie/articles/78249.html三十而立三十而立Tue, 31 Oct 2006 04:52:00 GMThttp://www.aygfsteel.com/robbie/articles/78249.htmlhttp://www.aygfsteel.com/robbie/comments/78249.htmlhttp://www.aygfsteel.com/robbie/articles/78249.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/78249.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/78249.htmlAbout data binding

Data binding is the process of tying the data in one object to another object. It provides a
convenient way to pass data around in an application. Adobe Flex 2 provides three ways to
specify data binding: the curly braces ({}) syntax and the <mx:Binding> tag in MXML and
the BindingUtils methods in ActionScript.

数据¾l‘定提供äº?ji¨£n)一¿Uä¾¿åˆ©çš„æ–ÒŽ(gu¨©)³•在程序中传递数据,它可以在一个对象和另一个对象间建立兌™”关系。在Flex2中提供了(ji¨£n)三种特定的方法用于数据绑定:(x¨¬)
1、{}
2�lt;mx:Binding>标签
3、ActionScript中的BindingUtilsæ–ÒŽ(gu¨©)³•

Common uses of data binding include the following:
通常使用数据¾l‘定的情形如下:(x¨¬)
â–?To bind properties of user interface controls to data service requests.
ž®†ç”¨æˆ·äº¤äº’界面中的输入绑定到数据服务è¯äh±‚中ã€?br />â–?To bind data service results to properties of user interface controls.
ž®†æ•°æ®æœåŠ¡å“åº”çš„¾l“æžœ¾l‘定到用户交互界面中ã€?br />â–?To bind data service results to a middle-tier data model, and to bind that data model’s
fields to user interface controls. For more information about data models, see Chapter 38,
“Storing Data,�on page 1001.
ž®†æ•°æ®æœåŠ¡å“åº”ç»“æžœç»‘å®šåˆ°å¤„äºŽä¸­é—´å±‚çš„æ•°æ®æ¨¡åž‹ä¸­ï¼Œå†å°†æ•°æ®æ¨¡åž‹çš„å­—ŒD늻‘定到用户交互界面中ã€?br />â–?To bind properties of user interface controls to a middle-tier data model, and to bind that
data model’s fields bound to a data service request (a three-tier system).
984 Binding Data
ž®†ç”¨æˆ·äº¤äº’界面中的输入绑定到处于中间层的数据模型中,再将数据模型的字ŒD늻‘定到数据服务è¯äh±‚中ã€?br />â–?To bind an ArrayCollection or XMLListCollection object to the dataProvider property
of a List-based control.
ž®†ArrayCollection或者XMLListCollection对象¾l‘定到基于List的界面控件的dataProvider属性中ã€?br />â–?To bind individual parts of complex properties to properties of user interface controls. An
example would be a master-detail scenario in which clicking an item in a List control
displays data in several other controls.
ž®†å¤æ‚属性的单个部分¾l‘定到用户交互界面中ã€?br />â–?To bind XML data to user interface controls by using ECMAScript for XML (E4X)
expressions in binding expressions.
通过使用ECMAScript for XML表达式将XML数据¾l‘定到用户交互界面中ã€?br />
Although binding is a powerful mechanism, it is not appropriate for all situations. For
example, for a complex user interface in which individual pieces must be updated based on
strict timing, it would be preferable to use a method that assigns properties in order. Also,
binding executes every time a property changes, so it is not the best solution when you want
changes to be noticed only some of the time.

ž®½ç®¡æ•°æ®¾l‘定是一个强大的机制åQŒä½†æ˜¯å…¶òq¶ä¸é€‚用于所有状å†üc(di¨£n)€‚比如在如下两种情况中就不适合使用数据¾l‘定åQ?br />1、在一个复杂的用户交互界面中,一些更新有严格的时间次序ã€?br />2、由于数据绑定在属性每‹Æ¡å‘生改变时都会(x¨¬)触发åQŒä»…仅希望在一些特定的条äšg下触发改变时ž®×ƒ¸é€‚合使用数据¾l‘定ã€?br />




]]>
Flex2 develop guide study - 1http://www.aygfsteel.com/robbie/articles/78176.html三十而立三十而立Mon, 30 Oct 2006 15:26:00 GMThttp://www.aygfsteel.com/robbie/articles/78176.htmlhttp://www.aygfsteel.com/robbie/comments/78176.htmlhttp://www.aygfsteel.com/robbie/articles/78176.html#Feedback0http://www.aygfsteel.com/robbie/comments/commentRss/78176.htmlhttp://www.aygfsteel.com/robbie/services/trackbacks/78176.html P980
Representing Data

RepresentingData.JPG
Data binding
The data binding feature provides a syntax for automatically copying the value of a property
of one client-side object to a property of another object at run time. Data binding is usually
triggered when the value of the source property changes. You can use data binding to pass user
input data from user interface controls to a data service. You can also use data binding to pass
results returned from a data service to user interface controls.

数据¾l‘定ç‰ÒŽ(gu¨©)€§å¯ä»¥åœ¨˜qè¡Œæ—¶è‡ªåŠ¨å°†ä¸€ä¸ªå®¢æˆïL(f¨¥ng)«¯å¯¹è±¡çš„属性复制到另一个客æˆïL(f¨¥ng)«¯å¯¹è±¡çš„属性。数据绑定通常当一个原对象的属性改变时被触发。你可以使用数据¾l‘定ž®†ç”¨æˆ¯‚¾“入数据传递至数据服务端。你也可以ä‹É用数据绑定将数据服务端的˜q”回å€ég¼ é€’至用户交互界面ã€?br />
Data models
The data model feature lets you store data in client-side objects. A data model is an
ActionScript object that contains properties for storing data, and that optionally contains
methods for additional functionality. Data models are useful for partitioning the user interface
and data in an application.

数据模型ç‰ÒŽ(gu¨©)€§å¯ä»¥å°†æ•°æ®å­˜å‚¨äºŽå®¢æˆïL(f¨¥ng)«¯åQŒä¸€ä¸ªæ•°æ®æ¨¡åž‹æ˜¯ä¸€ä¸ªActionScript对象åQŒè¿™ä¸ªå¯¹è±¡çš„属性与要存储的数据对应åQŒè¿™ä¸ªå¯¹è±¡ä¹Ÿå¯èƒ½åŒ…含一些其它方法。数据模型对于将½E‹åºä¸­çš„用户交互界面与数据分¼›»éžå¸¸æœ‰æ•ˆã€?br />
Data validation
The data validation feature lets you ensure that data meets specific criteria before the
application uses the data.

数据校验ç‰ÒŽ(gu¨©)€§ä‹É得程序在使用数据前,¼‹®ä¿æ•°æ®½W¦åˆä¸€å®šçš„æ ‡å‡†ã€?br />
Data formatting
The data formatting feature lets you change the format of data before displaying it in a user
interface control.

数据格式ç‰ÒŽ(gu¨©)€§ä‹É得在ž®†æ•°æ®æ˜¾½CÞZºŽç”¨æˆ·äº¤äº’界面前可以改变数据的昄¡¤ºæ ¼å¼ã€?/p>

]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º °²ÇìÊÐ| ÒÁ´¨ÏØ| ÏÃÃÅÊÐ| Íò°²ÏØ| ÎäÚìÏØ| Û·ÉÆÏØ| ¹ã×ÚÏØ| ÇØ°²ÏØ| »ÆÁêÏØ| ãòË®ÏØ| À­×ÎÏØ| ¸ßÐÛÏØ| ¶¨±ßÏØ| ÔúÄÒÏØ| ÔÀÑôÊÐ| Öз½ÏØ| ¶õÂ×´º×ÔÖÎÆì| ɳÑÅÏØ| ¬ÊÏÏØ| î¡ÄþÏØ| ¸ßÐÛÊÐ| ½­´¨ÏØ| µ¤ÑôÊÐ| ½­ÓÍÊÐ| ÎäÒØÏØ| ÉÌÂåÊÐ| »´°²ÊÐ| ÎÚÊ²ÏØ| »³Ô¶ÏØ| ÈÄÆ½ÏØ| ÑγØÏØ| ³£É½ÏØ| ÄϳÇÏØ| ¦µ×ÊÐ| ¹ÅÝþÏØ| ¸ñ¶ûľÊÐ| ´óͬÊÐ| ÕÃÎäÏØ| ÎýÁÖºÆÌØÊÐ| ×ÊÔ´ÏØ| ¹®ÒåÊÐ|