AS3 AVM1 Loader

I’ve been working on a project that needs to load FFmpeg generated SWF.
FFmpeg generates Flash 6 SWF. And there I got the problem, because AS3 can’t control AVM1 movies.

I googled and I found this AVM2Loader Class from Fladdict.
Simply talking, it loads the SWF and rewrites the necessary bytes to convert it to AVM2.
But, the problem was that this class just converts Flash 8 compiled AVM1.

So, I restarted my research.
Tried with Localconnection, but I got some delay on it’s response.

So I used ExternalInterface, and so far, it was working fine, until some guy tested on Safari 3 and got some slow script error.
Huh of course… I was loading douzens of avm1, everyone calling ExternalInterface on EnterFrame.

Thanks to google, I found the ultimate solution.
I found this other class ForcibeLoader that really converts any SWF versions to AVM2.

I rewrote this class for an easier syntax, but… I’ll be posting it when I get my svn and some kind of trac system ready.

So… thanks for all those byte eaters.

4 Comments »

  1. lestat1124 said,

    May 15, 2008 @ 1:13 am

    I have been looking for a solution for days now and after many many hours of fustration and trying out SWFBRIDGE, local connections and ExternalInterface I still find myself with the same damn problem! LOL I have this courseware that has a Flash Shell that was converted from AS2 to AS3 but all of the content is still AS2 and with literally over thousands of flash files, converting each of them to AS3 isnt feasible at this time. Now get this….the AS3 shell can successfully load the first AS2 swf content and control (play, stop, restart) it just fine. However when I load the second AS2 swf content and any content afterwards, NOTHING works. Its like the connections arent closing and/or unloading. Since I cant go into each and every AS2 content swf and add the appropriate localconnection code to them I have been scouring for another alternative. Do you think the ForcibeLoader.as would be a solution I should look into. Do you have any sample code that you have used thus far so i can see it in action and customize it for my project. Any help would be GREATLY appreciated!

  2. james said,

    July 31, 2008 @ 10:36 pm

    Hi,

    the ForcibeLoader works very well and is a very simple solution, but i think i may have come across a problem that occurs during the conversion.

    If you add an Event.ENTER_FRAME listener to the Loader.contentLoaderInfo of the Loader Object that you’ve passed to the ForcibeLoader Object and check the currentFrame and totalFrame properties in the function set up to handle the ENTER_FRAME, you’ll notice that the currentFrame never reaches the totalFrame? It seems to get to anything within 1- 4 frames before it and then gets no further. If i then leave it running it seems to cause flash player to slowly freeze up?

    I’ve tried producing AVM1 swfs through several different programs and always get the same results. Have you come across this problem?

  3. stef said,

    August 17, 2008 @ 1:21 am

    this is very useful,
    unfortunately it only works with flash 8 compiled swfs for me. do you have an idea why?
    I try to use fonts from a font2swf ( part of swftools , swf v6 i think) compiled clip.
    Is it fundamentally possible, when using your class successfully, to have access to the library of that loaded swf?

    Many thanks

  4. hcs said,

    September 19, 2008 @ 7:54 pm

    i tried using ForcibeLoader class but still not able to control the AVM1 movie.

    please help

RSS feed for comments on this post · TrackBack URI

Leave a Comment