Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class.

My problem is that the second time the moveShape method is called the moveAmt variable is undefined.

If anyone can suggest what's going on I would be really thankful!
Cheers
Ali

//////////////////Main.as
import gs.TweenFilterLite;
import utils.Numbers;
class Main {

        var minTime:Number = 1;
        var maxTime:Number = 2;
        //number of pixels to move shape up or down
        var moveAmt:Number = 15;        
        var _timeline:MovieClip;
        
        function Main(timeline){
                _timeline = timeline;
                moveShape(_timeline.y1);                
        }
        //moves a shape up or down
        private function moveShape(m:MovieClip)
        {
                trace("moveShape:"+m+" up:"+m.up);
                var moveDir:Number = 1;
                //if movieclip is tagged as moving up
                if(m.up){
                        moveDir = -1;   
                        m.up= false;            
                }else{
                        m.up=true;
                }
                var targetPos:Number = moveDir*moveAmt;
                trace("moveDir:"+moveDir);
                trace("moveAmt:"+moveAmt);
                trace("target:"+targetPos);
                var tweenTime:Number = Numbers.randRange(minTime, maxTime);
TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]});
        }
        
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to