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.

 

There may also be a way for you to do this with modules.  If you put
your bitmap cloning class in a module, there may be a way to load
multiple instances of the module, either by unloading and reloading it
or by using auto-generated URL variables.  Not sure about that though.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ian Thomas
Sent: Monday, October 22, 2007 3:51 PM
To: [email protected]
Subject: Re: [flexcoders] Take two: dynamic asset creation

 

Thanks Alex.

Bitmaps are only an example, here - any kind of derived Asset class
suffers from
the same issues.

I can understand your comments about CSS skinning etc.; and that the
Flex framework is
designed for embedding. 

The particular situation I am working in requires - specifically - that
image data in data-driven elements - for example, a TileList - is not
from embedded images, but is from runtime-generated images (whether they
are bitmaps or not is immaterial - I was using bitmaps 
as an example).

And we are in the process of building a framework that is completely
agnostic about where resources come from - from embeds, from external
libraries, from user-generated code, from cloning other resources, from
ByteArrays fetched across sockets etc. 

As I'm sure you can see, making that resource framework play nicely with
existing (or future) Flex components is very much on the agenda, and
we'd prefer not to have to customize existing Flex components (even via
ItemRenderers etc.) if we can just use them out of the box. (This is an
API which is being handed to other coders, and should therefore be as
clean as possible). 

At the root of it all, I do find it odd that if I have dynamically
generated, say, a BitmapAsset (without embedding) that I can't just pass
it into a Flex Component at the point at which it needs a BitmapAsset.
The trouble is, Flex needs a Class, and all I have is a (perfectly
valid) instance. That seems wrong. It seems there should be some way of
me being able to go backwards from my instance and find the original
class. And there is, of course, but it's useless to just pass a vanilla
BitmapAsset class in to Flex because you'll end up with a blank bitmap. 

Hence my problem. :-)


On 10/22/07, Alex Harui < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

        Anyway, if you absolutely have to do this, and you know the
total number of different assets you are going to create, you can make
different Bitmap subclasses that clone their bitmap data at
instantiation time and assign the dynamic assets to those Bitmap
subclasses.

 

 


 

         

        
________________________________






I don't quite get this - could you possibly expand on it further?

Thanks,
   Ian 

 

Reply via email to