Posted By

heathbo on 07/02/11


Tagged


Versions (?)

Load an external swf, use it and gain access to its functions and features.


 / Published in: ActionScript 3
 

How to load an external swf. Once its loaded, access it and use its functions and variables.

  1. function SourceMovie():void
  2. {
  3. var loader:Loader = new Loader();
  4. loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
  5. loader.load(new URLRequest('importedSwf.swf'));
  6. }
  7. function onLoadComplete(e:Event):void {
  8. var loaderInfo:LoaderInfo = e.target as LoaderInfo;
  9. addChild(e.target.content);
  10. var swf:Object = loaderInfo.content;
  11. swf.changeText();
  12. }
  13.  
  14. SourceMovie();
  15.  
  16.  
  17. // Runs function called changeText inside imported swf.
  18. // To access variables, change "changeText()" to the variable name.

Report this snippet  

You need to login to post a comment.