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Öоͻá³öÏÖÂ
Ïà¹ØÎĵµ£º
as ÔËËã·ûÊÇ ActionScript 3.0 ÖеÄÐÂÔöÔËËã·û£¬Ò²¿ÉÓÃÀ´¼ì²é±í´ïʽÊÇ·ñΪ¸ø¶¨Êý¾ÝÀàÐ͵ijÉÔ±¡£µ«ÊÇ£¬Óë is ÔËËã·û²»Í¬µÄ
ÊÇ£¬as ÔËËã·û²»·µ»Ø²¼¶ûÖµ£¬as ÔËËã·û·µ»Ø±í´ïʽµÄÖµ£¨´úÌæ true£©»ò null£¨´úÌæ false£©¡£ÏÂÃæµÄʾÀýÑÝʾÔÚ¼ì²é Sprite ʵÀý
ÊÇ·ñΪ DisplayObject¡¢IEventDispatcher ºÍ Number Êý¾ÝÀàÐ͵ijÉÔ±Õâ ......
ÔÎĵØÖ·£º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 ......
֮ǰ·¢¹ýһƬ¹ØÓÚFlex Builder 4×¢²áÂëµÄÎÄÕ£¬µ«ÊÇÓÉÓÚÀïÍ·µÄÐòÁкźÃÏñ¶¼¹ýÆÚÁË£¬ËùÒÔ¾ÍÓÖÕÒÁËÏ¿´ÈçºÎ¼¤»î¡£
Ê×ÏÈ°Ñ×Ô¼ºµÄhostsÎļþÀï¼ÓÉÏÒ»ÐУº
127.0.0.1 activate.adobe.com
È»ºóÔÚ´ò¿ªFlex Builder 4
ÊäÈëÈçÏÂ×¢²áÂ룺
1424-4118-1138-0912-4001-7222
×¢²á£¬OK
ÒÔºóǧÍò¼Çס²»ÒªÈÃQQÒ½Éú»òÕß360°ÑÄãµÄHostsÎÄ ......
ÓкÃÓõĶ«Î÷Ò»¶¨Òª¹²Ïí¡£
PaginationDataGrid.mxmlÎļþ·ÖÒ³×é¼þ
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script source="../../../common/utils/Commo ......