Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import flash.display.Sprite;
- import flash.display.Loader;
- import flash.net.URLRequest;
- /**
- * Loads SwfB in the same way a swf usually loads a swf.
- */
- public class SwfA extends Sprite
- {
- public function SwfA()
- {
- var flashVars:Object = root.loaderInfo.parameters;
- var s:String = this + "\n";
- for (var i:String in flashVars) {
- s += i + " = " + flashVars[i] + "\n";
- }
- trace("Main Client FlashVars:" + s);
- var ldr:Loader = new Loader();
- var urlReq:URLRequest = new URLRequest("SwfB.swf");
- ldr.load(urlReq);
- addChild(ldr);
- }
- }
- }
- package
- {
- import flash.display.Sprite;
- import flash.events.Event;
- /**
- * This class is loaded by SwfA and waits until it has been added to the stage
- * in order to obtain the flash vars from the stage.loaderInfo.
- */
- public class SwfB extends Sprite
- {
- public function SwfB()
- {
- addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
- }
- private function onAddedToStage(e:Event):void
- {
- var flashVars:Object = stage.loaderInfo.parameters;
- var s:String = this + "\n";
- for (var i:String in flashVars) {
- s += i + " = " + flashVars[i] + "\n";
- }
- trace("Loaded Swf FlashVars when Added to Stage: " + s);
- }
- }
- }
Add Comment
Please, Sign In to add comment