Posted By

damarev on 03/03/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

iamgowan


duplicate content


 / Published in: ActionScript 3
 

The duplicate content must have Linkage Class Name at the Library

  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.display.DisplayObject;
  5. import flash.display.Loader;
  6. import flash.display.LoaderInfo;
  7. import flash.net.URLRequest;
  8. import flash.events.Event;
  9. import flash.system.ApplicationDomain;
  10.  
  11. public class DuplicatLoadingMC extends Sprite
  12. {
  13. public function DuplicatLoadingMC()
  14. {
  15. var ldr:Loader = new Loader
  16. var aURL:String = "http://dina-cakes.com/LoadClass.swf";
  17. var aUrlReq:URLRequest = new URLRequest(aURL);
  18. ldr.load(aUrlReq);
  19. ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, OnCompleteLoad);
  20. }
  21.  
  22. //_______________________________________________________________________
  23.  
  24. public function OnCompleteLoad(event:Event):void
  25. {
  26. var aLoaderInfo:LoaderInfo = LoaderInfo(event.target);
  27. var aApplicationDomain :ApplicationDomain = aLoaderInfo.applicationDomain;
  28. var aLoadedClass:Class = aApplicationDomain.getDefinition("LoadedClass") as Class;
  29. var aDisplayObject1:DisplayObject = new aLoadedClass();
  30. var aDisplayObject2:DisplayObject = new aLoadedClass();
  31. this.addChild(aDisplayObject1);
  32. this.addChild(aDisplayObject2);
  33. aDisplayObject2.y = 200;
  34. }
  35. //_______________________________________________________________________
  36. }
  37. }

Report this snippet  

You need to login to post a comment.