View Single Post
  #1 (permalink)  
Old Jan 15th, 2007, 17:12
joe3dge joe3dge is offline
Junior Member
Join Date: Jan 2007
Location: Michigan
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Sequntial Tween- WHY WONT IT WORK??

Ok.
Can anyone solve this problem?

Im trying to get an object to move up 200 spaces and then move to the right 362.5 spaces. w/o useing frames, only action script

i put this code inside the movie clip:
Code: Select all
onClipEvent(load){
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    
    var firstTween1:Tween = new Tween(this,"_y",Regular.easeIn,this._y,this._y-200,2,true);
    firstTween1.onMotionFinished = function(){
        trace("Tween 1 Finished");
        var secondTween1:Tween = new Tween(this,"_x",Regular.easeIn,this._x,this._x+362.5,5,true);
        secondTween1.onMotionFinished = function(){
            trace("Tween 2 Finished");
        }
    }
}
the problem is, when i run the flash file, it runs the fisrt tween with out problem, then when its done, it displays the "Tween 1 finished" message like normal so i know the event handeler works, but then it just stops.

then i decided to see what would happen if i got rid of the fisrtTween1.onMotionFinished handeler.

My new code looks like:
Code: Select all
onClipEvent(load){
    import mx.transitions.Tween;
    import mx.transitions.easing.*;
    
    var firstTween1:Tween = new Tween(this,"_y",Regular.easeIn,this._y,this._y-200,2,true);
    //onMotionFinished removed
    trace("Tween 1 Finished");
    var secondTween1:Tween = new Tween(this,"_x",Regular.easeIn,this._x,this._x+362.5,5,true);
    secondTween1.onMotionFinished = function(){//onMotionFinished still there
              trace("Tween 2 Finished");
    }
}
everything work normally in THAT code sequence(even thought its not what it want) which tells me that the secon tween does in fact work

so i know a)my event hadeler works (i displayed the message) and b) my tweens work (they work in the second code)

so my question for all of you is... WHY WONT THEY WORK TOGETHER???

pleeeeeease this is driving me mad!

thanks, joe3dge

Last edited by joe3dge; Jan 15th, 2007 at 21:38.
Reply With Quote