Flex 3: Embedding MovieClip Symbol to Image Control programmatically

Posted by BlueDude on Stack Overflow See other posts from Stack Overflow or by BlueDude
Published on 2009-10-29T16:36:41Z Indexed on 2010/03/23 18:03 UTC
Read the original article Hit count: 302

I've reviewed all the documentation and Google results surrounding this and I think I have everything setup correctly. My problem is that the symbol is not appearing in my app. I have a MovieClip symbol that I've embedded to my Flex Component. I need to create a new Image control for each item from my dataProvider and assign this embedded symbol as the Image's source. I thought it was simple but apparently not. Here's a stub of the code:

[Embed(source="../assets/assetLib.swf", symbol="StarMC")]

private var StarClass:Class;

protected function rebuildChildren():void {

    iterator.seek( CursorBookmark.FIRST );

    while ( !iterator.afterLast ) {
    	child = new Image();
    	var asset:MovieClipAsset = new StarClass() as MovieClipAsset;
    	(child as Image).source = asset;

    }
}

I know the child is being created because I can draw a shape and and that appears. Am I doing something wrong? Thank you!

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3