FLEX:Bindable±êÇ©
[Bindable]¾ÍÊÇËùνµÄÔªÊý¾Ý±êÇ©¡£ÔªÊý¾Ý±êÇ©ÊÇÒ»ÖÖÌØÊâµÄ±êÇ©£¬ËüÔÚ´úÂëÖеÄ×÷ÓþÍÊÇÏò±àÒëÆ÷ÌṩÈçºÎ±àÒë³ÌÐòµÄÐÅÏ¢¡£Êµ¼ÊÉÏ£¬ÕâЩ±êÇ©²¢Ã»Óб»±àÒëµ½Éú³ÉµÄSWFÎļþÖУ¬¶øÖ»ÊǸæËß±àÒëÆ÷ÈçºÎÉú³ÉSWFÎļþ¡£
[Bindable]
BindableÔªÊý¾Ý±êÇ©ÊÇ×î¾³£Óõ½µÄÒ»¸öÔªÊý¾Ý±êÇ©£¬ÒòΪËüʹ³ÌÐò×é¼þÖ®¼äµÄÊý¾Ýͬ²½±äµÃºÜÈÝÒס£Bindable¿ÉÒÔÓÃÀ´°ó¶¨¼òµ¥Êý¾ÝÀàÐÍ¡¢Àà¡¢¸´ÔÓÊý¾ÝÀàÐÍÒÔ¼°º¯Êý¡£°ó¶¨Êý¾ÝµÄʱºò£¬Äã±ØÐëÏÈʹÓÃÔªÊý¾Ý±êÇ©¶¨ÒåÒ»ÏÂÊý¾Ý£¬
BindableÒ²¿ÉÒÔÓÃÀ´°ó¶¨µ½Ê¼þ¡£Listing 2չʾÁËÈçºÎʹÓÃgetterºÍsetterº¯Êý½«Ò»¸öÊôÐ԰󶨵½Ò»¸öʼþÉÏ¡£Õâ¸öÀý×ÓÖÐÓÐÒ»¸ö½Ð×öphoneNumberµÄ˽ÓбäÁ¿£¬»¹ÓÐÒ»¸ö¹«ÓÐµÄ setterºÍgetterº¯Êý¡£Ê¹ÓÃBindable±êÇ©½«Õâ¸ögetter·½·¨°ó¶¨µ½ÁËÒ»¸ö½Ð×öphoneNumberChangedµÄʼþÉÏ£¬Ö»Òª Êý¾Ý·¢Éú¸Ä±äsetter·½·¨¾Í»á·ÖÅÉphoneNumberChangedʼþ¡£Í¨¹ýʹÓÃsetter·½·¨£¬¿ÉÒÔÔÚÊý¾Ý¸³Óè˽ÓбäÁ¿Ö®Ç°¶ÔÆä½øÐвÙ×÷¡£ ÔÚÕâ¸öÀý×ÓÖУ¬Êý¾ÝÖ»ÓÐÔÚ³¤¶È´óÓÚµÈÓÚ10µÄʱºò²Å»á±»¸ñʽ»¯¡£µ±phoneNumberChangedʼþ±»·ÖÅɵÄʱºò£¬µÚ¶þ¸öTextInput×é¼þ »á±»¸üУ¬ÒòΪËûµÄtextÊôÐ԰󶨵½ÁËphoneNumber±äÁ¿ÉÏ¡£
µ±Ò»¸öÊôÐÔÀ´×ÔÒ»¸öÊý¾Ý±í´ïʽ£¬µ±Ô´ÊôÐԸıäʱ£¬Flex×Ô¶¯¸´ÖÆÔ´ÊôÐÔµÄÖµµ½ÈκÎÄ¿±êÊôÐÔ¡£ÎªÁ˱êʾ×ÅÒ»¸´ÖÆ£¬Äã±ØÐëʹÓÃ[Bindable]ÔªÊý¾Ý±êÇ©ÔÚflexÖÐ×¢²áÕâÒ»ÊôÐÔ£¬²¢ÇÒÔ´ÊôÐÔ±ØÐë·¢ËÍÒ»¸öʼþ¡£
[Bindable]ÔªÊý¾Ý±êÇ©²ÉÓÃÒÔϸñʽ
[Bindable]
[Bindable(event="eventname")]
Èç¹ûÄãÊ¡ÂÔÁËʼþÃû£¬flex×Ô¶¯´´½¨Ò»¸öʼþÃûpropertyChange
Äã¿ÉÒÔÔÚÈý¸öµØ·½Ê¹ÓÃ[Bindable]ÔªÊý¾Ý±êÇ©
1¡¢ÔÚpublic class¶¨Òåǰ
[Bindable]ÔªÊý¾Ý±êÇ©°ó¶¨ËùÓеÄ×÷Ϊ±äÁ¿¶¨ÒåµÄpublicÊôÐÔ£¬²¢ÇÒËùÓеÄpublicÊôÐÔ¶¼¶¨ÒåÓÐgetterºÍsetter·½·¨¡£ÔÚÕâÖÖÇé¿öÏ£¬[Bindable]ûÓвÎÊý£¬ÀýÈ磺
[Bindable]
public class TextAreaFontControl extends TextArea {}
flex±àÒëÆ÷×Ô¶¯´´½¨Ò»¸öʼþÃû½ÐpropertyChangeÓÃÓÚËùÓеĹ«ÓÐÊôÐÔ£¬ÕâЩÊôÐÔ¿ÉÒÔ×÷Ϊ°ó¶¨±í´ïʽµÄÔ´¡£ÕâÖÖ¶¨ÒåµÈͬÓÚ
[Bindable(event="propertyChange")]
Èç¹ûÊôÐÔÖµµÄ¸Ä±äÓëÔÀ´Ïàͬ£¬flex²¢²»´«µÝÕâ¸öʼþ»ò¸üÐÂÊôÐÔ¡£
2¡¢ÔÚpublic, protected »ò private ÊôÐÔǰ£¬¸ñʽΪ£º
[Bindable]
public var foo;
3¡¢Before a public, protected, or private property defined by a getter or setter method.
Äã±ØÐëͬʱ¶¨ÒågetterºÍsetter·½·¨£¬ÒÔ±ãÓÚʹÓÃ[Bi
Ïà¹ØÎĵµ£º
¸ù¾Ý±ðÈËдÁËÀ࣬×Ô¼ºÓÖÔö¼ÓÁËÒ»²¿·Ö£¬Ìù³öÀ´·ÖÏí
/*»ñµÃÁ½¸öÈÕÆÚÖ®²î */
public static function getDateDiff(startDate:Date, endDate:Date):int
{
var diff:Number = (Number(endDate) - Number(startDate))/(3600000*24);
return diff;
}
/* »ñµÃÏÖÔÚÈÕÆÚ */
public static function getDate() ......
ÉÏ´Î˵ÁËÖ±½Ó°Ñ×ÖÌåǶÈëµ½flex³ÌÐòÖеķ½·¨£¬Õâ´ÎдһϽ«×ÖÌå±àÒë³Éswfºó¹©ÆäËüflex³ÌÐò¼ÓÔØÀ´µ÷Óõķ½·¨¡£
Ê×ÏÈ£¬Ð½¨Ò»¸öactionscriptµÄproject£¬È¡ÃûΪFlexFont£¬½«×ÖÌåÎļþ·Åµ½src/fontĿ¼Ï£¬Ö÷³ÌÐòΪ
FlexFont.asÎļþ£¬ÄÚÈÝÈçÏ£º
package {
import flash.display.Sprite;
public class FlexFont extend ......
No.1 ij×Ö·ûÆ÷·Åµ½Õ³Ìù°æ:
System.setClipboard(strContent);
No.2 ¸´ÖÆÊý×é:
//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.addItem( i );
}
// fantastic ! //
var bar:ListCollectionView = new ListCollectionVi ......
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the DateTimeAxis class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.collections.ArrayCollection;
......
1¡¢Ô¤±¸ÖªÊ¶
FlexÊÇAdobeÌṩµÄ»ùÓÚFlash»·¾³µÄRIAÕ¹ÏÖ¼¼Êõ£¬Ö÷Òª²ÉÓÃMXML+Action ScriptÀ´±àд³ÌÐò¡¢½çÃæ£¬È»ºóͨ¹ý±àÒëÆ÷±àÒë³Éflash¸ñʽµÄSWFÎļþ·¢²¼µ½ÍøÕ¾ÉÏ¡£
ʵÏָù¦ÄÜÐèÒª°²×°Flex SDK£¬¿ÉÒÔ´ÓAdobeÍøÕ¾ÉÏÃæÏÂÔØ£¬»òÕß°²×°Flex Builder plugin+EclipseÀ´¿ª·¢¡£
ͬʱÐèÒª¾ß±¸¼òµ¥µÄÕýÔò±í´ïʽ֪ʶ¡£
2¡¢½çÃæ²¼¾ ......