/ Published in: ActionScript 3

How to load an external swf. Once its loaded, access it and use its functions and variables.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function SourceMovie():void { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete); loader.load(new URLRequest('importedSwf.swf')); } function onLoadComplete(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; addChild(e.target.content); var swf:Object = loaderInfo.content; swf.changeText(); } SourceMovie(); // Runs function called changeText inside imported swf. // To access variables, change "changeText()" to the variable name.
Comments
