Guest User

Untitled

a guest
Jun 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.display.Loader;
  5. import flash.net.URLRequest;
  6.  
  7. /**
  8. * Loads SwfB in the same way a swf usually loads a swf.
  9. */
  10. public class SwfA extends Sprite
  11. {
  12. public function SwfA()
  13. {
  14. var flashVars:Object = root.loaderInfo.parameters;
  15. var s:String = this + "\n";
  16. for (var i:String in flashVars) {
  17. s += i + " = " + flashVars[i] + "\n";
  18. }
  19. trace("Main Client FlashVars:" + s);
  20.  
  21. var ldr:Loader = new Loader();
  22. var urlReq:URLRequest = new URLRequest("SwfB.swf");
  23. ldr.load(urlReq);
  24. addChild(ldr);
  25. }
  26. }
  27. }
  28.  
  29.  
  30. package
  31. {
  32. import flash.display.Sprite;
  33. import flash.events.Event;
  34.  
  35. /**
  36. * This class is loaded by SwfA and waits until it has been added to the stage
  37. * in order to obtain the flash vars from the stage.loaderInfo.
  38. */
  39. public class SwfB extends Sprite
  40. {
  41. public function SwfB()
  42. {
  43. addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
  44. }
  45.  
  46. private function onAddedToStage(e:Event):void
  47. {
  48. var flashVars:Object = stage.loaderInfo.parameters;
  49. var s:String = this + "\n";
  50. for (var i:String in flashVars) {
  51. s += i + " = " + flashVars[i] + "\n";
  52. }
  53. trace("Loaded Swf FlashVars when Added to Stage: " + s);
  54. }
  55. }
  56. }
Add Comment
Please, Sign In to add comment