Flex»ù´¡ÖªÊ¶µã
ÔÚApplicationÖÐÌí¼Ó·ÇUIComponent×é¼þ
Æ©ÈçÒÔÏ´úÂë¾Í»á±¨´í£º
private function init():void { var sp:Sprite = new Sprite(); addChild(sp);}
TypeError: Error #1034: Ç¿ÖÆת»»ÀàÐÍʧ°Ü:ÎÞ·¨½« flash.display::Sprite@156b7b1 ת»»Îª mx.core.IUIComponent¡£
ÕâÊÇÒòΪApplicationµÄaddChild·½·¨²¢·ÇÍêÈ«¼Ì³Ð×ÔDisplayObjectContainer£¬
Application→LayoutContainer→Container →UIComponent→FlexSprite→Sprite
→DisplayObjectContainer
¶øÊÇÔÚContainerÄÇÀï±»ÖØдÁË£º
public override function addChild(child:DisplayObject):DisplayObject
ËäÈ»²ÎÊýchildµÄÀàÐÍÊÇDisplayObject£¬µ«ÊÇËü±ØÐëʵÏÖIUIComponent½Ó¿Ú£¨ËùÓÐFlex×é¼þ¶¼ÊµÏÖÁËÕâÒ»½Ó¿Ú£©£¬²ÅÄÜÌí¼Ó¡£
Èç¹ûÒªÔÚApplicationÀïÌí¼ÓSprite£¬¿ÉÒÔÏÈ°ÑËü×°½øÒ»¸öUIComponent£¬È»ºóÔÙÌí¼ÓÕâ¸öUIComponent£º
¹Ù·½µÄ˵·¨£º
* <p><b>Note: </b>While the <code>child</code> argument to the method
* is specified as of type DisplayObject, the argument must implement
* the IUIComponent interface to be added as a child of a container.
* All Flex components implement this interface.</p>
Àý×Ó£º
import mx.core.UIComponent;private function init():void {
var sp:Sprite = new Sprite();
var uc:UIComponent = new UIComponent();
uc.addChild(sp); addChild(uc);
}
ΪºÎÒªÖØÔØEventµÄclone·½·¨
Ò»°ãÇé¿öÏÂÊÇûÓÐÎÊÌâµÄ£¬µ«ÊÇÒÔÏÂÇé¾°Ï»á³öÎÊÌâ
¾Ù¸öÀý×Ó£¬ÀÏʦµãÃû£¬Ñ§ÉúÓ¦´ð£¬Èç¹ûѧÉúÓ¦´ðÒԺ󣬿δú±í¼Ç¼Òѵ½
Ê×ÏÈteacher.addEventListener(CallEvent.CALL, student.receive);
ÔÚteacherÉÏÌí¼ÓCallEvent,
teacher.call("name1" );
µ±teacher·¢³öcallʼþµÄʱºò£¬study»áÓ¦´ð£¬
public function receive(e:CallEvent):void
{
if (e.name == this.name)
{
trace(name + " is here");
this.dispatchEvent(e);
}
}
Èç¹û×öµ½ÕâÀï¾Í½áÊøÍêȫûÓбØÒªÖØÔØclone·½·¨£¬µ«ÊÇÈç¹ûºóÐø¿Î´ú±íÒª¼àÌýѧÉúµÄreceiveʼþ¼Ç¼µÄʱºò¾Í±ØÐëÒªÖØÔØ
EventµÄclone·½·¨£¬·ñÔòµÄ»°£¬student.addEventListener(CallEvent.CALL, add);ÔÚaddÖоͻá³öÏÖÂ
Ïà¹ØÎĵµ£º
»ù±¾Ê¼þ´¦Àí
ÓÃÓÚÖ¸¶¨ÎªÏìÓ¦Ìض¨Ê¼þ¶øÓ¦Ö´ÐеÄÌض¨²Ù×÷µÄ¼¼Êõ³ÆΪʼþ´¦Àí¡£ÔÚ±àдִÐÐʼþ´¦ÀíµÄ ActionScript ´úÂëʱ£¬ÄúÐèҪʶ
±ðÈý¸öÖØÒªÔªËØ£º
• ʼþÔ´£º·¢Éú¸ÃʼþµÄÊÇÄĸö¶ÔÏó£¿ÀýÈ磬Äĸö°´Å¥»á±»µ¥»÷£¬»òÄĸö Loader ¶ÔÏóÕýÔÚ¼ÓÔØͼÏñ£¿Ê¼þÔ´Ò²³ÆΪʼþÄ¿
±ê£¬ÒòΪ Flash Player »ò AIR ½«´Ë¶ÔÏó×÷Ϊ ......
//1.¸´ÖÆÄÚÈݵ½ÏµÍ³¼ôÌù°å
System.setClipboard(strContent);
//2.¸´ÖÆÒ»¸öArrayCollection
//dummy solution( well, it works )
var bar:ArrayCollection = new ArrayCollection();
for each ( var i:Object in ac ){
bar.addItem( i ); }
// fantastic ! //
var bar:ListCollecti ......
ÔÎĵØÖ·£ºhttp://aaagu1234.blog.163.com/blog/static/400937152010022114749766/
Flex°²È«É³Ïä
FlexµÄ×îÖØÒªÁ½¸öÎļþ£ºMXMLÎļþÓëASÎļþ¡£
MXMLÓëASµÄhello world£¬ÈçºÎ±àÒëÕâ¾Í²»ËµÁË£¨»¹ÓÐFlexÓëFlashʲôÇø±ðµÈµÈÕâЩ»ù±¾µã¶¼²»ÓÃÌáÁË£©£º
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmln ......
ViewStackµ¼º½ÈÝÆ÷×îΪÆÕͨ£¬ÒòΪËü×ÔÉí²»´øµ¼º½¿Ø¼þ¡£ÎÒÃÇÐèÒªÌí¼ÓһЩµ¼º½¿Ø¼þ£¬¶øÆäËûµ¼º½ÈÝÆ÷¾ù´øÓÐ×Ô¼ºµÄ¿Ø¼þ¡£
ViewStackÊÇ´æ·ÅÊý¾ÝµÄÂß¼ÈÝÆ÷£¬×÷ÓÃÊÇÈÃÿ¸ö²¼¾ÖÈÝÆ÷£¨Æä×ÓÈÝÆ÷£©ÔÚ¶¥²¿»¥Ïà¶Ñµþ¡£´ÓÄ»ºó¿ÉÖª£¬ÕâЩ×ÓÈÝÆ÷±»ÉèÖÃΪһ¸öÊý×飨0£¬1£¬2…£©¡£
&nb ......
ÊʺϳõѧÕßÀí½â
1£¬testflex.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="init()"
minWidth="955 ......