0
votes

So I have run into an issue and I think it is mostly because I haven't worked with as2 in about 5 years so things are pretty hazy. Anyway, my problem is that I need to display PDF files within the flash movie. To do so I have resorted to running SWFTools in my backend and converting pdfs to swf for display. SWFTools, though, outputs AS2 files which I can load into AS3 but I can't actually control (for example, calling stop()).

Thus I have resorted to using an AS2 loader which gets loaded into the AS3 project which is responsible for loading the converted pdf swfs. The problem I am running into is that the listener does not seem to be firing when I load the AS2 file in via AS3 but it fires just fine when run on it's own.

This is the code I am running. To summarize when I run this code on it's own "LOADED" correctly prints to the output and the loaded SWF stops. However, when I run it via an AS3 container the swf loads in correctly but the "LOADED" trace never occurs and the stop is not executed.

thanks so much for any help!

var loader:MovieClipLoader

var listener =  new Object();
listener.onLoadComplete = function(loadedClip) {
    trace("LOADED");
    loadedClip.stop();
}

loadFile("data/testing.swf");

function loadFile(target){
    loader = new MovieClipLoader();
    loader.addListener(listener);
    loader.loadClip(target, holder_mc);
}
1

1 Answers

0
votes

SWF Tools does support AS3, you need to change it in the options.

1. Open your PDF in swf tools
2. Edit=>Options
3. Viewer tab
4. Check "No viewer" and flash version 9. (Or use the simple viewer) 
    - You can also do the "Insert stop after each frame"

I know this because I've done the same thing with a PDF. If you don't have those options, then it's time to download the latest version!