Did you check out Repeater?

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of genuinexeal
Sent: Monday, October 23, 2006 7:47 AM
To: [email protected]
Subject: [flexcomponents] Component factory

 

Hi there,

I am trying to create a factory component that will instantiate other
components based on the data loaded from the server. I know how to do
it for non visual classes/objects, but for visual components it's not
very clear for me what path should I follow.

Having a "factory component" like this:

<container id="containerComp">
<factoryComponent id="factoryComp" width="400" height="300"
label="some label" click="clickHandler()"/>
</container>

I would like to be able to say something like this (pseudo AS3 code):

private function onDataLoaded(e:Event) {
// this should both instantiate a new component derived from
CompBase and initialize it with factoryComp's properties (defined in MXML)
var cb:CompBase = factoryComp.create(e.result.compType);

containerComp.removeChild(factoryComp);
containerComp.addChild(cb);
}

I tried actually implementing the above code but it does not work. I'm
getting a ton of runtime errors...

I also looked into deferred instantiation and IFactory/ClassFactory
but the help is scarce on these topics. Some code samples would really
help there.

Has anybody tried something similar? Any ideas on how to do this?

TIA,
Alex

__._,_.___


SPONSORED LINKS
Software development tool Application development software Development software
Development outsourcing software Embedded software development

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to