AVM1 Content in AS3?

October 4th, 2007 | by Marc |

So this is a pseudo rant/question for the masses.

I've been trying to load up some legacy content in CS3/AS3.
I've read all of the liveDocs on this subject and have figured out that you ...
A. AVM1 content is contained in a AVM1Movie class which you cannot extend
B. AVM1 content can only communicate over LocalConnection
C. AVM1 content cannot user loadMovie to load in additional SWFs.

So what we're talking about here is that AVM1 content is really only good for animating crap when someone in your office only has Flash 8. Here's why .. You could use LocalConnection to do some cross-scripting, but that would require you to have the FLA for the legacy content ... and this isn't always possible. At this point, should you have the FLA, the LocalConnection hack is like using the ExternalInterface class to communicate with JavaScript. It's not bad, but not ideal for cross-scripting between Flash content.

If you have access to the original FLA, why not just make it a CS3 doc. I know, I know, you don't want to recode everything .. but apparently you can't use LoadMovie, and I have all but 1 project in my whole career that didn't LoadMovie for something. Apparently you can use LoadMovieNum .. or something .. but at that point you're recoding ... and why not just set up a Loader() to do the deed.

Why the rant? Well ... I'm trying to load legacy content into a Flash 9 swf. However, I do not have access to the original FLAs. No big deal. I can load them in and play with them .. etc .. which is about as useful as loading in an animated GIF. The problem is, each SWF is expecting a variable on _root that would typically be assigned through the HTML EMBED tag or swfObject. Now if SWFs can get variables from the parent that embedded them, why can't legacy content receive data through the parent (Flash 9) SWF that loaded it?

I know it breaks the whole coding standards of AS3, but would it be too much to be able to assign dynamic variables to that magical AVM1Movie wrapper? or something? or do I have no idea what I'm talking about?

  1. 7 Responses to “AVM1 Content in AS3?”

  2. You could try to use the query string to send in variables to the AVM1 SWF.

    For example, loading in “avm1.swf?myVar=hi” would create _root.myVar in that SWF.

    Paulo on Oct 4, 2007 | Reply

  3. You’re correct, for all the noise about backward compatability – Adobe has broken the paltform be destroying all previous content made with Flash…

    Dave_Matthews on Oct 4, 2007 | Reply

  4. I recommend making a stink about this, be loud. I talked to a flash player architect about some issue’s I was having with captivate in flex. avm1 – avm2 communication is poor. He indicated that there was some noise on the channel, but theres not really a big push to get this figured out in the player. Speak up, join in, send in bug requests.

    ian on Oct 4, 2007 | Reply

  5. Very cool. There is definitely some awesome feed back on the issue. Paulo, your recommendation is awesome. I never considered that. However, to add insult to injury (on my part), the experiment is in AIR and (as far as I know) you can’t pass arguments to a file reference (ie: File.url or File.nativePath). Ah well .. I’m not going to give up on your recommendation though. I’ll keep ‘screwing’ with it.

    Anywho .. Ian .. you’re right. I’m pretty good at being a loud-mouth idiot, I should totally start directing this energy at Adobe. What were they thinking .. not support AVM1 content to its fullest…

    Marc on Oct 4, 2007 | Reply

  6. i haven’t tried this technique, but Jesse Warden wrote a couple of blog posts about using a proxy AVM1 SWF to communicate between AVM2 and the legacy AVM1 content using LocalConnection. instead of recoding the AVM1 content, you create a new AVM1 SWF that does the localconnection communication with the flash 9 parent, and LoadMovie()s the legacy SWF.

    for some reason, those blog posts have been removed from his blog, but google cache still has them:

    http://tinyurl.com/24rz2c
    http://tinyurl.com/yozssu

    bunnyhero on Oct 7, 2007 | Reply

  7. The simple answer is it’s not really just an oversight on Adobe’s part. I once read a techincal white paper on the JVM (this was when AS3 was still a fluffy magic pill) and what they were doing to completely re-write it. And they did just that at the assembly level.

    So the long answer is AS3 runs in a completely separate context. Asking adobe to just “allow” us to run AVM1 / AVM2 code natively in the same process is akin to asking to run both 32bitWin / 64bitWin / Dos all natively. It just doesn’t work, the only thing they could do to appease the masses is to write an emulator, but we all know how fast emulators are.

    Mike on Nov 20, 2007 | Reply

  8. This may not be related but you might want to look at AVM2Loader class in libSpark.

    Soo on Sep 3, 2009 | Reply

Post a Comment