This might help: http://www.jessewarden.com/archives/2006/08/flash_9_button.html
Can I ask why you're building your game in Flex though? Doesn't seem like it would provide (m)any advantages over straight up Flash. HTH, Ben --- In flexcoders@yahoogroups.com, "pinkmongrel" <[EMAIL PROTECTED]> wrote: > > 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. > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/