views:

1690

answers:

1

Hi,

I seem to be having trouble with TweenLite in AS2.

I've created a class which I call on the main timeline. Within the class I've loaded images and once they are loaded I want to fade between them. I am calling (inside my class) the following code when the images have finished loading:

TweenLite.to(_root["loadedimg1"], 1, {_alpha: 100, 
            onComplete:doImageLoop, onCompleteParams:[1], onCompleteScope:this});

I then have the following function to do the fade loop:

public function doImageLoop(imageId:Number):Void 
{
 trace(imageId);
 var newImageId:Number;
 TweenLite.to(_root["loadedimg" + imageId], 1, {delay:2, _alpha: 0});
 if ((imageId + 1) > queueCount) {
  newImageId = 1;
 } else {
  newImageId = imageId + 1;
 }
 TweenLite.to(_root["loadedimg"+newImageId], 1, {delay:3, _alpha: 100, 
              onComplete:doImageLoop, onCompleteParams:[newImageId], 
              onCompleteScope:this, overwrite:0});
    }

This function never gets hit but this first image does fade up.

A: 

Hi there,

Your code works perfect with me.. I'm still doing some minor AS2 stuff myself so I thought I'd try to answer you. I've put three picture-mc's on stage called:loadedimg1, loadedimg2 and loadedimg3. Then I've created a empty MovieClip with a class connected to it called 'test'. The class contains the following code:

import gs.TweenLite;

class test extends MovieClip {
private var queueCount : Number = 3;

function test() {
 TweenLite.to(_root["loadedimg1"],1,{_alpha:100, onComplete:doImageLoop, onCompleteParams:[1], onCompleteScope:this});
}

function doImageLoop(imageId:Number):Void {
 trace(imageId);
 var newImageId:Number;
 TweenLite.to(_root["loadedimg"+imageId],1,{delay:2, _alpha:0});
 if ((imageId+1)>queueCount) {
  newImageId = 1;
 } else {
  newImageId = imageId+1;
 }
 TweenLite.to(_root["loadedimg"+newImageId],1,{delay:3, _alpha:100, onComplete:doImageLoop, onCompleteParams:[newImageId], onCompleteScope:this, overwrite:0});
}
};

Maybe you can give us a more detailed example of how your classes are arranged and how deep your application is coded. Trying NOT to lose scope was always the main priority in AS2. :(

Hope I can help a little later...

Ypmits