AVMovie1 and AVMovie2

Published:
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.
0
3,624 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.