flexѧϰ ×Ô¶¨Òåʼþ
ÎÒ¸öÈ˾õµÃÕâ¸ö×Ô¶¨Òåʱ¼ä·â×°ÐԺܺ㬵«ÊÇÓе㸴ÔÓ£¬²»½¨Òé¼òµ¥±à³ÌÖÐʹÓÃ
´´½¨Ò»¸öMXML×é¼þ£¬½¨×Ô¶¨Òåʼþ
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
private function clickHandler():void{
// var myEvent:Event = new Event("nameDataShared");
var myEvent:TextEvent = new TextEvent("nameDataShared");
myEvent.text = myNameInput.text;
dispatchEvent(myEvent);
}
]]-->
</mx:Script>
<!--Metadata±êÇ©²¢²»±àÒëµ½¿ÉÖ´ÐдúÂëÖУ¬µ«Ëü»áÌṩÐÅÏ¢¿ØÖÆÄãµÄ´úÂëÈçºÎ±àÒë¡£
²»ÄÜ°ÑActionScript»òMXML´úÂë·Åµ½Metadata±êÇ©ÖУ¬ËüÊÇÌØÊâµÄÖ¸Áî¡£
¸æËß±àÒëÆ÷ÕýÔÚ´´½¨Ò»¸ö×Ô¶¨Òåʼþ²¢ÃüÃû¡£È磺[Event(name="nameDataShared")]¡£Õâ¸ö·½À¨ºÅ½Ð×ömeta±êÇ©¡£
-->
<mx:Metadata>
// [Event(name="nameDataShared")]
[Event(name="nameDataShared", type="flash.events.TextEvent")]
</mx:Metadata>
<mx:Label text="Name Dispatcher" fontSize="16"/>
<mx:HBox>
<mx:Label text="Enter Your Name"/>
<mx:TextInput id="myNameInput"/>
</mx:HBox>
<mx:Button label="Click ME" click="clickHandler()"/>
</mx:VBox>
´´½¨Ö÷³ÌÐòÎļþ
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:components="components.*">
<mx:Script>
<!--[CDATA[
[Bindable]
private var sharedNameData:String = "Default Name";
function sharedNameDataHandler(evt:TextEvent):void{
sharedNameData = evt.text;
}
]]-->
</mx:Script>
<components:NameDispatcher x="35" y="40" nameDataShared="sharedNameDataHandler(event)"/>
<components:ReceiveName x="35" y="120" myName="{sharedNameData}"/>
</mx:Application>
´´½¨Ò»¸ö½ÓÊÕ×é¼þ
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<!--[CDATA[
[Bindable]
public var myName:
Ïà¹ØÎĵµ£º
Flex Builder 3 ÏÂtrace() ²»Êä³öµÄÎÊÌâ
ÏÂÃæ¸ø³ö¼òµ¥µÄ´úÂ루main.mxml£©£º
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Button label="Test Trace" click="test()"/>
<mx:Script>
<!--[CDATA[
......
1.ÔÚ<Object>ºÍ<embed>ÖÐÉèÖÃflashVars²ÎÊý
£¬ÀýÈ磺
<object
id=’mySwf’ classid=’clsid:D27CDB6E-AE6D-11cf-96B8-444553540000′
codebase=’http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab’
height=’100%’ width=’10 ......
Silverlight×÷ΪһÃÅм¼ÊõÍƳöÒѾÈýÄ꣬ÔÚSilverlightÔçÆÚ°æ±¾£¬´ó¼Ò¶¼ÈÏΪSilverlightµÄ¹¦ÄÜÎÞ·¨ºÍFlex½øÐжԱȣ¬¸üÊÇÎÞ·¨³¬Ô½Flex£¬ÔÚ2009Äê11Ô£¬Î¢ÈíÍƳöÁËSilverlight 4²âÊÔ°æ±¾£¬ÒÔÆäÇ¿´óµÄ¹¦ÄÜÓÖÒ»´ÎÎüÒýÁËÖڶ࿪·¢ÈËÔ±µÄÑÛÇò£¬Ðí¶àÔø¾ÔÚFlexÏÂÖ§³ÖµÄ¹¦ÄÜ£¬ÏÖÔÚSilverlightÏÂÒѾ¿ÉÒÔʵÏÖ£¬¶øÇÒ»¹ÓÐһЩÐµĹ¦ÄÜ£ ......
¹ØÓÚstates
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Script>
<![CDATA[
import mx.effects.easing.Bounce;
]]>
</mx:Script>
<mx:states>
<mx:State name="bookDetails" ......