Flex: how to load a .swf and use its library?
-
13-09-2019 - |
Question
I have a symbol in a .swf's library, with a linkage name of "Pana". The Pana symbol is just a 100 frame animation that I would like to have timeline control over in Flex. So how can I load the .swf and then add the Pana symbol to the display list and control it's timeline?
Thanks!
Solution
You would use the getDefinition function from the ApplicationDomain Class. A fairly simple example can be found here:
OTHER TIPS
You can embed that symbol in your MXML:
[Embed(source="yourlib.swf#SymbolName")]
private var swfSymbol:Class;
And then use it as:
// Cast it as MovieClip
var symb:MovieClip = new swfSymbol() as MovieClip;
addChild(symb);
// And control the timeline
symb.gotoAndPlay('someFrameLabel');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow