> Canvas.addChild(Sprite),
You cannot do this because "The DisplayObject to add as a child of this Container. It must implement the IUIComponent interface."
Sprite does not implement IUIComponent. Basically all children of a container have to be a IUIComponent becasue of the way Flex lays them out.
Example, Sprite does not have a measuredWidth property. That would kill the Canvas's layout engine.
This release of AS3 is really misleading when it comes to things like this. Using;
child:DisplayObject
as the param means it MUST be a DisplayObject. The 'catch' is that in as3 you can not change the type of a parameter in a subclass.
If you could the addChild() method of Container would look like
addChild(child:IUIComponent)
That is a misunderstanding I see a lot of people running into these days.
This part of Container inforces the IUIComponent interface rule;
// Throw an RTE if child is not an IUIComponent.
var uiChild:IUIComponent = IUIComponent(child);
You will get the runtime exception there.
Peace, Mike
On 8/11/06, dadrobson <
[EMAIL PROTECTED]> wrote:
I stand corrected:
I wrote "extend" instead of "implement".
Thanks Mike!
-Jim
--
What goes up, does come down. __._,_.___
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
Web site design development Computer software development Software design and development Macromedia flex Software development best practice
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
- [flexcoders] Re: Newbie Question - attaching a Sprite danfrap767
- [flexcoders] Re: Newbie Question - attaching a Sprit... dadrobson
- [flexcoders] Re: Newbie Question - attaching a S... danfrap767
- Re: [flexcoders] Re: Newbie Question - attac... Tom Bray
- Re: [flexcoders] Re: Newbie Question - attac... Michael Schmalle
- [flexcoders] Re: Newbie Question - attac... danfrap767
- Re: [flexcoders] Re: Newbie Question - attaching a S... Michael Schmalle
- [flexcoders] Re: Newbie Question - attaching a S... dadrobson
- Re: [flexcoders] Re: Newbie Question - attac... Michael Schmalle
Reply via email to