Schemaphic Systems Blog

Sharing experiences in Flash, Flex and AIR

Tween issues in loading AVMovie1 in AVMovie2

leave a comment »

Today 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 loading AVMovie1 in AVMovie2.

I had a Tween created in my home.swf which works 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.

After much debugging, I changed my Tween class to use greensock AS2.0 version in home swf. Same thing happened; individually the home ran absolutely fine, but when called through 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) ;

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

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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: