Need to trigger a function within a loaded swf file
Copy link to clipboard
Copied
This is my scenario, this week a colleague contacts me to tell me there is a problem with a piece of work put out by us 8 months ago. There is no source file but they need to make the content work with a clicker. So I decompile the swf and find the call to move on to the next slide, so far so good. I make a wrapper to load in the original swf file and set up the code for the clicker. The problem I am having is I am super rusty when it comes to AS3 and I cannot trigger the function within the loaded swf to move the content on.
This is the decompiled code in the loaded swf, I have highlighted the function I need to call:
My initial thought was to create a new instance of the class "ActionsContext" in my wrapper then use that to target the function but so far I am coming up short. As I say I am super rusty so if anyone could give me a hand I would REALLY appreciate it.
Thanks
Kai
Copy link to clipboard
Copied
your loader's content property is a reference to the main timeline of the loaded swf. if that swf is a movieclip, you would use:
MovieClip(your loader.content) when loading is complete and the function to be referenced exists.
Copy link to clipboard
Copied
Thanks for the reply. I am creating a movieClip to load the swf into, below is my code:
var request:URLRequest = new URLRequest("start.swf");
var loader:Loader = new Loader()
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
loader.load(request);
addChild(loader);
function loader_complete(evt:Event):void{
trace("load complete");
var embedSWF:MovieClip = MovieClip(evt.target.content);
addChild(embedSWF);
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void {
if (e.keyCode == Keyboard.PAGE_DOWN){
trace("PAGE_DOWN");
}
if (e.keyCode == Keyboard.PAGE_UP){
trace("PAGE_UP");
}
}
}
Copy link to clipboard
Copied
embedSWF (which can't be used after loading completes) is a reference to the loaded swf's main timeline. take it from there.
Copy link to clipboard
Copied
Sorry but I am going to need more help, as I say my AS3 skills are super rusty.
Copy link to clipboard
Copied
what's the path from the loaded swf's main timeline to the function you want to call?

