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Öоͻá³öÏÖÂ
Ïà¹ØÎĵµ£º
• String£ºÒ»¸öÎı¾Öµ£¬ÀýÈ磬һ¸öÃû³Æ»òÊéÖÐijһÕµÄÎÄ×Ö
• Numeric£º¶ÔÓÚ numeric ÐÍÊý¾Ý£¬ActionScript 3.0 °üº¬ÈýÖÖÌض¨µÄÊý¾ÝÀàÐÍ£º
• Number£ºÈκÎÊýÖµ£¬°üÀ¨ÓÐСÊý²¿·Ö»òûÓÐСÊý²¿·ÖµÄÖµ
• Int£ºÒ»¸öÕûÊý £¨²»´øСÊý²¿·ÖµÄÕûÊý£©
• Uint£ºÒ»¸ö“ÎÞ·ûºÅ”ÕûÊý£¬¼´²»ÄÜΪ¸º ......
ÔÎÄ£ºHow to dispatch an event from a custom item renderer
´Ó MXML ×é¼þÖзÖÅÉʼþ²¢²»À§ÄÑ£¬µ«ÊÇÏëÒª´Ó itemRenderer ÖзÖÅÉʼþ¾ÍûÓÐÄÇôֱ½ÓÁË¡£ÏÂÎÄÖУ¬ÎÒÃǽ«»Ø¹ËÒ»ÏÂÕâÁ½ÖÖÇé¿öµÄ´¦Àí·½Ê½²¢ÕÒ³öÒ»¸öºÏÊʵĽâ¾ö·½°¸¡£
Õý³£Çé¿öÏ£¬µ±ÄãÏë´Ó MXML ×é¼þÖзÖÅÉÒ»¸öʼþʱ»áʹÓÃÈçϵÄÔªÊý¾Ý±êÇ©£º
<!-- дÔÚÄ ......
1.Á¬½Ó×Ö·û´®:Á¬½Ó×Ö·û´®Ö¸Á½¸ö¼°Á½¸öÒÔÉϵÄ×Ö·û´®ºÏ²¢³ÉΪһ¸ö×Ö·û´®.
1.1."+"²Ù×÷·ûÁ¬½Ó×Ö·û´®
¸ñʽ:×Ö·û´®1+×Ö·û´®2+...;
//½á¹ûΪ"Thisworks"
var example:String="This"+"works";
//½á¹ûΪ"There are 24 people"
var attendance:int=24;
var output:String="There are&nb ......
ÔÚeclipseÖÐн¨ÁËÒ»¸öwebÏîÄ¿ È»ºóÔÚwebÏîÄ¿ÖÐÏëÌí¼Óflex ¿ª·¢Ç°Ì¨¡£ÔÚwebÏîÄ¿ÃûÉϵã»÷ÓÒ¼ü ----flex project Nature ----- Add flex project Nature ÔÚµ¯³öµÄ¶Ô»°¿òÖÐ ÉèÖÃÈçͼ£º
È»ºó µã»÷ next
Flex WAR file £º Ñ¡Ôñ ÄãµÄblazeds µÄ·¾¶ È»ºóµã»÷ Finish
½á¹û ÏîÄ¿ÏÔʾº ......
####################
#
ÃæÏò¶ÔÏó±à³Ì¸ÅÄî
####################
1
ÀàÎļþ
Çø·ÖOOP³ÌÐòºÍ¹ý³Ìʽ³ÌÐòµÄÊÇ´úÂëµÄ²ð·Ö·½Ê½¡£¹ý³Ìʽ³ÌÐòʹÓõÄÊdz¤ÐòÁеĴúÂë¡£¶øOOP³ÌÐòÔò»á°Ñ´úÂë
·Ö³É¶à¸ö¸üС¡¢¸üרÃÅ»¯µÄÎļþ£¬ÕâЩÎļþ±»³ÆΪÀàÎļþ(class
file)¡£
& ......