Dear Alex Harui, I think that will help!
We just need to create a class with getInstance() method that returns the instance we need based on the parameter we passed to the constructor Say for example, BitmapFactory class that takes bitmapData as a parameter and returns a bitmapAsset using the given bitmapData when getInstance method is called myButton.icon = new BitmapFactory(myBitmapData); will get it right :) Regards, Arul ----- Original Message ----- From: Alex Harui To: flexcoders@yahoogroups.com Sent: Wednesday, October 24, 2007 1:27 AM Subject: RE: [flexcoders] Take two: dynamic asset creation That?s fine. We wouldn?t do what you suggested though, we?d use IClassFactory in more places ------------------------------------------------------------------------------ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: Tuesday, October 23, 2007 6:37 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Take two: dynamic asset creation Hi Alex, I've submitted this as a feature request on the Flex tracker. As an aside, the simplest solution is (I think) a very straightforward change to the Flex API. If the expected data fields were extended so that as well as 'icon' you passed in 'iconArguments' and those arguments, if present, were used as arguments to the asset constructor it would solve it all. And I don't think it would impact performance appreciably - the only difference is that internally Flex would call new SomeAssetClass(someArgs) instead of new SomeAssetClass(). The parameterisation of those constructors would open up so much more potential. Cheers, Ian On 10/23/07, Alex Harui <[EMAIL PROTECTED]> wrote: If we can figure out a way to allow this in the future, we will. You aren't the first person to ask for it. When we wrote 2.0, we were so worried about performance we made assumptions that skipped levels of indirection like the one you want.