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

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-with-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

On 10/22/07, Arul <[EMAIL PROTECTED]> wrote:
>
>    Dear Ian,
>
> I understand your use-case, I also needed something similar
>
> Let me do a quick experiment and get back to you on this
>
> Regards,
> Arul
>
> www.shockwave-india.com/blog/
>
>
>
>
> ----- Original Message -----
> *From:* Ian Thomas <[EMAIL PROTECTED]>
> *To:* [email protected]
> *Sent:* Monday, October 22, 2007 10:43 PM
> *Subject:* [flexcoders] Take two: dynamic asset creation
>
>  Here's an easier way to explain the problem I posted about earler.
>
> If I create some BitmapAssets manually rathern than using embed:
>
> var b1:BitmapAsset=new BitmapAsset(someBitmapData1);
> var b2:BitmapAsset=new BitmapAsset(someBitmapData2);
> var b3:BitmapAsset=new BitmapAsset(someBitmapData3);
>
> How do I then pass them to something like a TileList, which expects an
> icon property of type Class:
>
> var rowData:Object={label:"Some Label",icon:WhatGoesHere};
>
> Where WhatGoesHere can't be BitmapAsset (that just produces an empty
> bitmap). Nor can it be b1, because that's not of type Class.
>
> The goal here is to achieve this without creating a new ItemRenderer.
>
> Thanks in advance,
>     Ian
>
>  
>

Reply via email to