There are rules for what children can be added to what parents.  Is it
possible you are not following those rules?  "sprite" is a much lowe
level class than I have ever used, are you sure it can accept the child
you are adding?

 

Alex has posted these rules multiple times.   Something like:

Container can accept container or UIComponent, UIComponent can accept
anything, ... etc I do not know whare sprite fits into that.

 

Tracy 

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Weyert de Boer
Sent: Monday, May 05, 2008 5:49 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Child items in custom component

 

Sorry, to bug, but does anyone happen to have any ide?

Weyert

> Hello!
>
> I am currently a bit clueless regarding using Flex components. I am
> currently trying to port a .NET component to Flex. Only I have some
> problems. In a simplified form the problem is that I am trying to add
> childs to the component. The idea is to use public method to add nodes
> to the component. The code could be:
>
> var node: MyNode = new MyNode();
> node.width = node.height = 125;
> myComponentInstance.addNode( node );
>
> The addNode-method is basically contains:
>
> public function addNode( node: MyNode ): void {
> _nodeContainer.addChild( DisplayObject(node) );
> invalidateDisplayList();
> }
>
> The _nodeContainer is a Sprite class which gets created in the
overriden
> createChildren-method. Now I would be expected that the
MyNode-instance
> (which just draws a simple rectangle 125x125) would be shown. Sadly
> enough, this is not the case.
>
> Does anyone know what should be done to get this working?
>
> Yours,
> Weyert de Boer
>
> 

 

Reply via email to