The renderers, and icons in buttons are almost always class instances because embedding small assets and instantiating them is the fastest way of getting them on-screen.
The notion of customizing bitmaps is less common as Flash is a better vector-graphics engine than a bitmap-engine. Also, security rules prevent you from modifying bitmaps from other domains that you don't have explicit permission. Also, I'm not sure why you need to customize the assets at runtime. Why not load different assets via runtime CSS? 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. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: Monday, October 22, 2007 9:02 AM To: [email protected] Subject: Re: [flexcoders] Take two: dynamic asset creation Thank you, Alex. But as I said, that's what I'm trying to avoid doing; it means that I can't supply runtime-created asset data via any other means than rewriting/extending every single Flex component that I need to do it for. That seems completely backwards, and seems an ill-thought-out strategy in the creation of the Flex framework. Ian On 10/22/07, Alex Harui <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: You would write a custom itemRenderer to show bitmaps instead of class instances. ________________________________ From: [email protected] [mailto: flexcoders@ <mailto:flexcoders@> yahoogroups.com <http://yahoogroups.com> ] On Behalf Of Ian Thomas Sent: Monday, October 22, 2007 8:47 AM To: [email protected] Subject: Re: [flexcoders] Take two: dynamic asset creation Thanks Arul, The more I delve in to this and experiment with it the more I'm beginning to think it's not possible. Ben Stucki has an interesting post on a similar solution: http://blog.benstucki.net/?p=42 <http://blog.benstucki.net/?p=42> But it relies on you needing to know exactly which component container the resulting object is destined for, and that won't work in TileLists (because ItemRenderers get reused). Josh Tynjala has a slightly different solution: http://www.zeuslabs.us/2007/09/28/actionscript-3-bitmap-image-classes-wi th-functions-and-loaders <http://www.zeuslabs.us/2007/09/28/actionscript-3-bitmap-image-classes-w ith-functions-and-loaders> But it hits the same issue that I did, which is that in AS3 Function!=Class any more. It feels like it _ought_ to be easy. If it's really true that we can't use runtime-created assets with the Flex framework without handrolling a load of different ItemRenderers or creating our own subclasses of the Flex components, then that's very depressing and seems ill-thought-out. :-( Cheers, Ian

