AVMovie1 and AVMovie2

Published on
9,143 Points
Last Modified:
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions.

Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share.  I developed a flash site in AS3.0 but due to some constraints I had to use the home page of another Flash movie developed in AS2.0; so basically I was loading a AVMovie1 movie into another AVMovie2 movie.

I had a Tween created in my home.swf which worked well on first load within AVMovie2. But the problem started when I navigated to another section and again returned to Home. This time, surprisingly, none of the Tweens in home.swf worked!  I checked multiple times to be sure that when I navigated, I cleared my home loader which I added to the base flash movie.

After much debugging, I changed my Tween class to use GreenSock AS2.0 version in home swf. Still the same thing happened; individually the home ran absolutely fine, but when called through the base movie, all the tweens ran perfect only for the first time.

I actually wasted my whole day at it but was lucky enough to get to a solution at the end of the day.

I came to know that when an AS2/AS1-based swf is subloaded into an AS3-based one, then unloaded, and another one is loaded subsequently, a bug in the Flash Player prevents the onEnterFrame from working properly and the _root reference becomes invalid.

The source of my knowledge was from the code comments provided in TweenLite class.

The code which did the trick was to add this line:
TweenLite.jumpStart(_root) ;

Open in new window

Please note: I used this._lockroot() in the home.swf also.

I hope this will help someone to avoid wasting time in such scenario.

This article was originally published on my blog.

Featured Post

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Join & Write a Comment

The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month