0

i just want to ask if it's possible get the URL link from an external shock wave flash file through loader and add child function.

Basically the shock wave flash file is just an image that you can click and will send you to a link similar to the href in html. I need to fetch the URL to be able top load it in the stage Web View function.

1 Answer 1

1

You can access the URL, but only if the URL is stored in a public variable on the swf you are loading.

You can use loaderinfo to get what you are looking for. You can even call public functions of the loaded swf as well. See this code example:

// load external swf
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete);
loader.load(new URLRequest('your_external_swf.swf'));

private function swfLoadComplete(e:Event):void 
{
    // create LoaderInfo instance for loaded swf 
    var loaderInfo:LoaderInfo = e.target as LoaderInfo;
    // add swf to stage, or a parent movieclip... whatever
    addChild(e.target.content);
    // cast an object to the content property of loaderInfo
    var swf:Object = loaderInfo.content;
    // access a variable in your loaded swf
    trace(swf.yourVariable) ;
    // call a function in your loaded swf
    swf.yourFunctionName();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.