Hi,

There's a good bit in the docs about using flash based graphics in Flex apps p.666 of the Developer Guide "Using SWF files as Skins".  Basically you just end up using the swf as a graphics library.  All the graphics have to be on the stage so that they're actually included in the swf (or export in 1st frame in the linkage properties).  You don't actually run the swf in your Flex app, but  import the graphics using their library linkage name.
For example:
                <mx:Button id="SoundOffBtn"
                    x="342" y="310"
                    upSkin="@Embed(source='../../../assets/icons/GalleryButtons01.swf', symbol='VolumeOffUpSkin')"
                    overSkin="@Embed(source='../../../assets/icons/GalleryButtons01.swf', symbol='VolumeOffOverSkin')"
                    downSkin="@Embed(source='../../../assets/icons/GalleryButtons01.swf', symbol='VolumeOffOverSkin')"
                    click="toggleMute()" />

HTH

Phil


pinkmongrel 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.


-- 
______________________________________________________________ 
Phil Marston 
Technology Enhanced Learning
Centre for Learning & Teaching 
University of Aberdeen
Aberdeen
AB24 3QY

Email: [EMAIL PROTECTED]
Tel: +44(0)1224 273329
Mob: +44(0)7798 723660 
Web: http://www.abdn.ac.uk/clt/
______________________________________________________________

The University of Aberdeen Open Day 29th August 2006
Booking is essential
www.abdn.ac.uk/openday
email [EMAIL PROTECTED]
or call 0800 027 1495
__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to