1¡¢Ô¤±¸ÖªÊ¶
FlexÊÇAdobeÌṩµÄ»ùÓÚFlash»·¾³µÄRIAÕ¹ÏÖ¼¼Êõ£¬Ö÷Òª²ÉÓÃMXML+Action ScriptÀ´±àд³ÌÐò¡¢½çÃ棬Ȼºóͨ¹ý±àÒëÆ÷±àÒë³Éflash¸ñʽµÄSWFÎļþ·¢²¼µ½ÍøÕ¾ÉÏ¡£
ʵÏָù¦ÄÜÐèÒª°²×°Flex SDK£¬¿ÉÒÔ´ÓAdobeÍøÕ¾ÉÏÃæÏÂÔØ£¬»òÕß°²×°Flex Builder plugin+EclipseÀ´¿ª·¢¡£
ͬʱÐèÒª¾ß±¸¼òµ¥µÄÕýÔò±í´ïʽ֪ʶ¡£
2¡¢½çÃæ²¼¾Ö¡¢´úÂëʵÏÖ
Îļþ£ºQQWeather.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="213" height="234" creationComplete="initApp()" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#F6FBFC, #3FEEDC]">
<mx:Style>
.myfont{font-size:12pt;font-family:'ËÎÌå';}
</mx:Style>
<mx:Script source="QQWeather.as"></mx:Script>
<mx:Label x="10" y="53" text="Ñ¡Ôñ³ÇÊÐ:" styleName="myfont"/>
<mx:ComboBox id="cmbCity" x="66" y="49" width="133" rowCount="6" change="changeHandler(event);" styleName="myfont"></mx:ComboBox ......
Ç°ÆÚ×¼±¸£º
µã»÷File²Ëµ¥ -> New -> MXML Component£¬È»ºóµ¯³öÒ»¸ö¶Ô»°¿ò¡£
ÔÚ¶Ô»°¿òÖÐÊäÈë×é¼þÃû£¬Ñ¡Ôñ´Ë×é¼þ¼Ì³ÐµÄÀàÐÍ£¬È磺Canvas£¬DataGrid£¬ComboBox …… µÈ¡£
È»ºóÑ¡Ôñ×é¼þµÄ´óС£¬µã»÷Finish¼´¿É¡£
¹ØÓÚ×é¼þ¼Ì³ÐµÄÀàÐÍ£¬¼ÙÉèBased on Canvas£¬ÄÇô×é¼þµÄ¸ùÔªËؼ´Îªmx:Canvas£¬´ËÔªËصĺ¬ÒåΪ¿Õ°×Ãæ°å£¬ÄÇôÉè¼ÆÈËÔ±¿ÉÒÔÈÎÒâÔÚÕâ¸öÃæ°åÈÝÆ÷ÄÚ·ÅÖÃÈκζ«Î÷£¬¾ÍÏñ¿ª·¢Ö÷³ÌÐòÒ»Ñù¡£ÄÇô´Ë×é¼þÀàËÆÒ»¸öÈÝÆ÷¡£
Èç¹ûBased on ComboBox£¬ÄÇô¸ùÔªËؼ´Îªmx:ComboBox£¬´ËÔªËصĺ¬ÒåΪÏÂÀ¿ò£¬ÄÇôÉè¼ÆÈËÔ±¿ÉÒÔÔÚÏÂÀ¿òµÄµÄÄÚ²¿ÈÎÒⶨÖÆÄÚÈÝ»ò´úÂ룬ÄÇô´Ë×é¼þ¶¨ÖÆÁËÒ»¸öÏÂÀ¿ò¡£
Àý£¬µÇ¼×é¼þ£º
ÖÆ×÷×é¼þ£º
Ê×ÏÈ°´ÕÕÉÏÃæµÄ²½Öèн¨Ò»¸ö×é¼þ£¬ÃûΪCLogin.mxml£¬Based on TitleWindow¡£TitleWindowÔªËØ´ú±íÓбêÌâµÄ´°¿Ú¡£
&n ......
¶ÔÓÚÏ°¹ßÁËʹÓÃ×ÀÃæÓ¦ÓóÌÐòµÄÓû§¶øÑÔ£¬»Ø³µºóÏÂÒƽ¹µãµ½ÏÂÒ»¸ö±à¼×é¼þÖеÄС¹¦ÄÜ£¬ÊǷdz£ÌùÐĵģ¬ÀûÓÃflexÖеÄKEY_DOWNʼþ¿ÉÒÔ·½±ãµÄʵÏֻسµÏÂÒƽ¹µã£¬´úÂëÈçÏ£º
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="CreationComplete()" height="398" width="518" backgroundColor="#E6E3E3">
<mx:Script>
<!--[CDATA[
import mx.containers.HBox;
import mx.core.UIComponent;
import mx.events.CloseEvent;
import mx.controls.Alert;
public function CreationComplete():void{
var monthNames:Array=new Array;
var dayNames:Array=new Array;
monthNames.push("Ò»","¶þ","Èý","ËÄ","Îå","Áù","Æß","°Ë","¾Å","Ê®","ʮһ","Ê®¶þ");
dayNames.push("ÈÕ","Ò»","¶þ","Èý","ËÄ","Îå","Áù");
this.edtccrq.monthNames = monthNames;//ÖÐÎÄÔ·ÝÃû
this.edtgrrq.monthNames = monthNames;
this.edtrzrq.monthNames = monthNames;
this.edtccrq.dayNames = dayNames;//ÖÐÎÄÐÇÆÚÃû ......
[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 ÕýÔò±í´ïʽѧϰ×ÊÁÏ
Ò»°ãÀ´Ëµ¸÷¸ö¿ª·¢»·¾³»òÕßÓïÑÔ¶ÔÓÚÕýÔò±í´ïʽµÄ
ʵÏÖ²»ÊÇÍêÈ«Ò»ÑùµÄ£¬µ«ÊDzî±ð¶¼·Ç³£Ï¸Î¢¡£AS3°´ÕÕECMA262±ê׼ʵÏÖÕýÔò±í´ïʽ£¬¸Ð¾õ°ïÖúÎĵµ¶ÔÕⲿ·Ö½éÉܵIJ»ÊǺܺ㬺ܶà¸ÅÄûÓн²Çå³þ£¬ÕâÀïÕÒµ½ÁËÒ»¸ö²»´íµÄѧϰ×ÊÁÏ£¬Èç¹û°ïÖúÎĵµÀïÃæÓп´²»¶®µÄ¿ÉÒԲο¼Ï£¡
½Ò¿ªÕýÔò±í´ïʽµÄÉñÃØÃæÉ´ ¹Ø±Õ¸ßÁÁ
[Ô´´ÎÄÕ£¬×ªÔØÇë±£Áô»ò×¢Ã÷³ö´¦£ºhttp://www.regexlab.com/zh/regref.htm
]
ÒýÑÔ
ÕýÔò±í´ïʽ£¨regular expression£©¾ÍÊÇÓÃÒ»¸ö“×Ö·û´®”À´ÃèÊöÒ»¸öÌØÕ÷£¬È»ºóÈ¥ÑéÖ¤ÁíÒ»¸ö“×Ö·û´®”ÊÇ·ñ·ûºÏÕâ¸öÌØÕ÷¡£±ÈÈç
±í´ïʽ“ab+” ÃèÊöµÄÌØÕ÷ÊÇ“Ò»¸ö 'a' ºÍ ÈÎÒâ¸ö 'b' ”£¬ÄÇô 'ab', 'abb', 'abbbbbbbbbb'
¶¼·ûºÏÕâ¸öÌØÕ÷¡£
ÕýÔò±í´ïʽ¿ÉÒÔÓÃÀ´£º£¨1£©ÑéÖ¤×Ö·û´®ÊÇ·ñ·ûºÏÖ¸¶¨ÌØÕ÷£¬±ÈÈçÑéÖ¤ÊÇ·ñÊǺϷ¨µÄÓʼþµØÖ·¡££¨2£©ÓÃÀ´²éÕÒ×Ö·û´®£¬´ÓÒ»¸ö³¤µÄÎı¾ÖвéÕÒ·ûºÏÖ¸¶¨ÌØÕ÷µÄ×Ö·û´®£¬±È²éÕҹ̶¨×Ö·û´®¸ü¼ÓÁé»î·½±ã¡££¨3£©ÓÃÀ´Ìæ»»£¬±ÈÆÕͨµÄÌæ»»¸üÇ¿´ó¡£
ÕýÔò±í´ïʽѧϰÆðÀ´ÆäʵÊǺܼòµ¥µÄ£¬²»¶àµÄ¼¸¸ö½ÏΪ³éÏóµÄ¸ÅÄîÒ²ºÜÈÝÒ×Àí½â¡£Ö®ËùÒԺܶàÈ˸оõÕ ......
¶Ô°üº¬×Ô¶¨ÒåÃüÃû¿Õ¼äµÄXML ½øÐзÖÎöÊDZȽÏÀ§ÄѵÄ, ËüÒªÇó¸ÃÃüÃû¿Õ¼äÒ»¶¨ÒªÔÚÈκÎXML ·µ»ØÇ°±»ÉêÃ÷, ͬʱҪÔÚ¸ÃÃüÃû¿Õ¼äÄÚ½øÐзÖÎö¡£±ÈÈç¶ÔÓÚÒÔϵÄÒ»¸öxml£º
test.xml
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:PriceResult>
<m:Price>34.5</m:Price>
</m:PriceResult>
</soap:Body>
</soap:Envelope>
ÔÚApplicaitonÖÐÈçÏ£º
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
<mx:Script>
<!--[CDATA[
import mx.rpc.events.ResultEvent;
//load the xml
private function loadXML():void
{
https.send();
}
private function doResult(evt:ResultEvent):void
......