Flex×Ô¶¨Òå×é¼þÓë×Ô¶¨Òåʼþ
1¡¢×Ô¶¨Òå×é¼þ
2¡¢×Ô¶¨Òåʼþ
3¡¢½áºÏʹÓÃ
Ò»¡¢×Ô¶¨Òå×é¼þ£¨Ê¹ÓõÄÊÇFlex×é¼þ£¬ActionScript×é¼þÏà¶ÔÂé·³µã£¬¿ÉÊÓ»¯²îµã£©
¸Ã×é¼þÓÉÒ»¸öTextAreaºÍÁ½¸öButton×é³É£¬Èçͼ£º
´úÂ룺
MyComponent.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="180" height="94" creationComplete="initComponent()">
<mx:Metadata>
/**
* 1. ±àÒëÆÚ¼äÖ´ÐÐ
* 2. ×Ô¶¨Òå×é¼þÒ»°ã¿ÉÒÔͨ¹ýdispatchEventίÅÉparentÀ´´¦Àíij¸öʼþ£¬Õâ¾ÍÐèÒªÔÚparentÖÐÉèÖÃÒ»¸öaddEventListerÀ´¼àÌýʼþ¡£
* ¾ÍÏñButtonµÄEvent.CLICKʼþ£¬³ýÁË¿ÉÒÔͨ¹ýaddEventLister(Event.CLICK, clickHandle)À´¼àÌý´¦ÀíÍ⣬ÔÚFlex×é¼þÖл¹¿ÉÒÔ
* Ö±½Ó mx:Button click="clickHandle(event)" / ¡£Ôõô¶¨Òå×Ô¶¨Òå×é¼þÒ²¿ÉÒÔ´ïµ½Èç´ËЧ¹ûÄØ£¿
* 2.1) ÄÚ²¿ÉùÃ÷£º[Event(name="commit",type ="laxino.MyEvent")]£¬typeÊÇָʼþµÄÀàÐÍ£¨Èç1µÄÀàÐÍÊÇint,'aaa'µÄÀàÐÍÊÇString£©,nameÊÇÖ¸
* EventÖеĹ¹Ô캯ÊýÖÐtype¡£
* 2.2) ÍⲿʹÓãºcommit="commitHandle(myEvent)"ÊÇָΪ¸Ã×é¼þ×¢²áÁËÒ»¸ö¼àÌýÆ÷£¬¼àÌýÃû×Ö½ÐcommitµÄʼþ£¬²¢Í¨¹ýcommitHandle´¦Àí¡£Ê¼þµÄ´¥·¢ºÍ
* ίÅɱØÐëÔÚ×é¼þÄÚʵÏÖ¡£
*
*/
/**
*
* Using the Event metadata tag
* You use the [Event] metadata tag to define events dispatched by a component so that the Flex compiler can recognize
* them as MXML tag attributes in an MXML file. You add the [Event] metadata tag in one of the following locations:
* ActionScript components Above the class definition, but within the package definition, so that the events are bound
* to the class and not a particular member of the class.
* MXML components In the mx:Metadata tag of an MXML file.
*
*/
[Event(name="commit",type ="laxino.MyEvent")]
[Event(name="preview",type ="laxino.MyEvent")]
</mx:Metadata>
<mx:Script>
<!--[CDATA[
private function initComponent():void
{
}
private function preview(event:Event):void
{
this.dispatchEvent(new MyEvent(MyEven
Ïà¹ØÎĵµ£º
Ò»¡¢¹úÍâÕ¾µã
1.×ÊÔ´ Àà
Adobe Flex 2 Component Explorer £º ¹Ù·½µÄ£¬Õ¹Ê¾Á˸÷ÖÖ×é¼þ µÄÓ÷¨ £¬ÈëÃÅ ±Ø¿´¡£
CFlex £ººÜºÃµÄÒ»¸öFlex×ÊÔ´Õ¾µã£¬°üÀ¨½Ì³Ì £¬ÐÂÎÅ£¬×ÊÔ´Õ¾µã…… Ö»ÊÇÒ³ÃæÓеãÔÓÂÒ£¬´ó¼ÒÒ»°ã¿´ÓÒ±ßÄÇÒ»À¸¾ÍÐÐÁË¡£
FlexBox £ºÒ»¸öÊÕ¼¯ ÁËÍøÉϺܶ࿪Դ ×é¼þµÄÕ¾µã£¬Êǽø½×ѧϰ µÄºÃ°ïÊÖ¡£
Flex ......
firefoxϵ±flashÉèÖòÎÊý wmode Ϊ transparent »òÕß Opaque ʱºòÎı¾¿òÖÐÊäÈëÖÐÎÄ»á³öÏÖÎÊÌâ¡£
µÍ°æ±¾µÄfirefoxÖÐÎÞ·¨ÊäÈëÖÐÎÄ£¬¸ß°æ±¾ÖÐÔò³öÏÖÂÒÂë¡£
ÂÒÂëÓëflashºÍÒ³Ãæ±àÂ뷽ʽ¶¼Ã»ÓйØϵ£¬ÊÇfirefoxµÄbugÔì³ÉµÄ¡£
½â¾ö·½·¨Ö»ÓÐʹÓÃwmodeµÄĬÈÏÖµ£¬µ«ÊÇÕâÑùʹµÃflashÔÚÕû¸öÒ³ÃæµÄ×îÉϲ㣬divµÈ¶¼»á±»ÆäÕÚµ²×¡¡£
¼Ç ......
FLEX±àÒëµÄSWFÎļþ£¬Ö»ÄÜÑ¡Ôñ·ÃÎʱ¾µØÎļþ»ò·ÃÎÊÍøÂçÎļþ£¬¶þÕßÖ»ÄÜÈ¡Ò»£¨àÅ£¬ÎªÊ²Ã´£¿ÎÒÒ²²»ÖªµÀ£¬¹Ù·½ËµÊÇΪÁË°²È«¿¼ÂÇ£©£¬¶øFLEX±àÒëµÄĬÈÏÑ¡ÏîÊÇÖ»ÄÜ·ÃÎÊÍøÂçÎļþ£¬ËùÒÔÄ㽫binÀïµÄ¶«Î÷COPYµ½ÆäËûµØ·½¾Í²»ÄܶÁÈ¡ÁË¡£¶øÄãÔÚĬÈϵÄbinĿ¼Ï¿ÉÒÔ¶ÁÈ¡µÃµ½£¬ÊÇÒòΪFLEXÈÏΪÄãÊÇÔÚIDE»·¾³ÖÖ£¬ÕâʱÊÇûÓÐÕâ¸öËùνµÄ°²È«ÏÞÖÆµÄ ......
£¨1£©treeµã»÷ʼþpublic function handleList(ev:ResultEvent)
{
sourceList=ev.result as ArrayCollection;
}
private function tree_itemClick(evt:ListEvent):void {
var item:Object = Tree(evt.currentTarget).selectedItem;
if (pmtree.dataDescriptor.isBranch(item)) {
......