# Displaying Flash 9 symbols in Flex - Trying for an elegant solution

**URL:** <https://forum.kirupa.com/t/displaying-flash-9-symbols-in-flex-trying-for-an-elegant-solution/198719>\
**Category:** flash\
**Created:** [August 28, 2006, 3:51am UTC](https://forum.kirupa.com/t/displaying-flash-9-symbols-in-flex-trying-for-an-elegant-solution/198719 "2006-08-28T03:51:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougsha](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@dougsha](https://forum.kirupa.com/u/dougsha)\
**Post date:** [August 28, 2006, 3:51am UTC](https://forum.kirupa.com/t/displaying-flash-9-symbols-in-flex-trying-for-an-elegant-solution/198719/1 "2006-08-28T03:51:11Z")

</div>

I’ve been trying to find an elegant way to display MovieClip symbols from a Flash 9 swf in a Flex app. I am rewriting my old game ChipWits (google it) and have a bunch of graphics which I need to repeat for walls, floors… All the graphics are in Symbols with auto-generated classes (coffee class for the coffee symbol).

I have it working in a very inelegant manner by putting named instances of each of the Symbols on the stage. In Flex I call a function in the swf’s Document class that moves the symbol to 0,0 and makes it visible in the swf:

private var mc\_Item:MovieClip = null;

public function showInstanceInSWF(itemName:String):void {  
// If it has the property draw it  
if( this.hasOwnProperty(itemName) ) {  
// Get rid of any old instance in the SWF  
if(this.mc\_Item != null) {  
this.mc\_Item.visible = false;  
this.mc\_Item = null;  
}  
// Point mc\_Item to the MovieClip on stage named itemName  
this.mc\_Item = this[itemName];  
if(this.mc\_Item != null) {  
this.mc\_Item.x = 0;  
this.mc\_Item.y = 0;  
this.mc\_Item.alpha = 100; // They are alpha=0 in Flash  
this.mc\_Item.visible = true;  
}  
}  
}

This means that for every piece of floor, wall, etc. onstage I need to load another SWF.

What I’d like to do is something like:

public function returnSymbolFromClass( className:String ):MovieClip {  
var mc:Object = null;  
try {  
var ClassReference:Class = getDefinitionByName(className) as Class;  
mc = new ClassReference();  
}  
catch(e:ReferenceError) {  
trace(e);  
}  
return MovieClip(mc);  
}

and then to take the MovieClip and addChild it in my app outside the loaded SWF.

This has me pulling my hair out. I am breaking my swf’s up so there is one symbol in each, but again this is very kludgy.

Any help will be grovellingly appreciated.
