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()

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of rafaelrfc00
Sent: Wednesday, July 23, 2008 9:53 PM
To: [email protected]
Subject: [flexcoders] Re: new Component() ?

 

Text was just an example. 

It can be date, text, textarea, some other customcomponents. I was
just curious how i would create item renderes without creating a file.

I thought if you are able to use <mx:component> you would be able to
create it from actionscript as well.

guess i was wrong. Flex didn't think about everything, do they? :P

raf

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Josh McDonald" <[EMAIL PROTECTED]> wrote:
>
> Well no, you can't do what you're asking :)
> 
> When you use:
> 
> <mx:component>
> <canvas>
> ...
> </canvas>
> </mx:component>
> 
> It's creating a new subclass of Canvas with a generated name, and
you can't
> create new classes at run-time without bytecode manipulation (which
isn't
> really an option in Flex yet unfortunately).
> 
> But what exactly are you trying to achieve? If you're just
displaying text,
> but it needs to be different to the field data, what you need is a
> labelFunction, not an itemRenderer.
> 
> -Josh
> 
> On Thu, Jul 24, 2008 at 10:34 AM, Rafael Faria
<[EMAIL PROTECTED]>
> wrote:
> 
> > Hi Pedro,
> >
> > How do you mean about putting some getters? Can you give me an
example?
> >
> > Thanks
> > Raf
> >
> >
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> , "Pedro Sena" <sena.pedro@>
wrote:
> > >
> > > Hi Rafael,
> > >
> > > What do u think of put some getters in your object instead of
create
> > various
> > > item renderers that just have little funcionality ?
> > >
> > > Just my 2 cents
> > >
> >
> >
> > ------------------------------------
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
<http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt> 
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo
<http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo> ! Groups
> > Links
> >
> >
> >
> >
> 
> 
> -- 
> "Therefore, send not to know For whom the bell tolls. It tolls for
thee."
> 
> :: Josh 'G-Funk' McDonald
> :: 0437 221 380 :: [EMAIL PROTECTED]
>

 

Reply via email to