You can't add to the class definition of the Canvas at runtime.
ClassFactory has a properties bag where you can have properties slapped
on the new instance, but that's not really a new class definition.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Amy
Sent: Thursday, July 24, 2008 7:36 AM
To: [email protected]
Subject: [flexcoders] Re: new Component() ?

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> If you've defined a component via <mx:Component>, the name is
> auto-generated as Josh says, but it generates an IFactory, so you 
can
> use the factory to get new instances
> 
> 
> 
> <mx:List id="myList>
> 
> <mx:itemRenderer>
> 
> <mx:Component>
> 
> <mx:Canvas>
> 
> ..
> 
> 
> 
> 
> 
> From AS:
> 
> 
> 
> myList.itemRenderer.newInstance()

This makes it sound like the equivalent to new Component() in AS 
might be

myRenderer:ClassFactory = new ClassFactory(mx.containers.Canvas);

Presumably from there you can add stuff to myRenderer before using it 
as your "rubber stamp", but I've never personally used ClassFactory 
for anything other than setting global properties on a class I 
created in AS3 or MXML.

Is this a correct interpretation of how AS3 works?

Thanks;

Amy

 

Reply via email to