A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Tweening with actionscript - repeating/cycling issue

  1. #1
    Grandmaster Flash
    Join Date
    Apr 2004
    Location
    Edinburgh, Scotland
    Posts
    139

    Tweening with actionscript - repeating/cycling issue

    Hi

    I am using MX2004 Pro. I am trying to produce a cycling effect on some scripted tweening, using the mx.transitions classes. The idea is that when one transition finishes it triggers the next. It's kind of recursive - everything works apart from the function call from within the onMotionFinished event handler. Ie. it fails to cycle. Here is my for the function in question:

    Code:
    public function tweenNextRelease():Void
    {
    	var clipRef:MovieClip = eval('this.r' + _currentRelease);
    	trace(_currentRelease + "  Clipref = " + clipRef._name);
    	var myTween:Object = new Tween(clipRef, "_alpha", Regular.easeIn, 100, 0, 1, true);
    	mx.transitions.TransitionManager.start(clipRef, myTween);
    		
    	if(this._currentRelease == 0 ) this._currentRelease = _releases.length;
    	this._currentRelease--;
    		
    	myTween.onMotionFinished = function() {
    		trace("Finished: " + clipRef._name);
    		clipRef.tweenNextRelease(); // keep cycling
    	};
    
    }

    Any ideas where I am going wrong?

    TIA
    If it ain't broke, don't fix it.

  2. #2
    Grandmaster Flash
    Join Date
    Apr 2004
    Location
    Edinburgh, Scotland
    Posts
    139
    Thanks for no views! Dont worry I fixed it myself

    Code:
    public function tweenNextRelease():Void
    {
    	var clipRef:MovieClip = eval('this.r' + _currentRelease);
    	trace(_currentRelease + "  Clipref = " + clipRef._name);
    	var myTween:Object = new Tween(clipRef, "_alpha", Regular.easeIn, 100, 0, 1, true);
    	mx.transitions.TransitionManager.start(clipRef, myTween);
    		
    	if(this._currentRelease == 0 ) this._currentRelease = _releases.length;
    	this._currentRelease--;
    		
    	myTween.onMotionFinished = function() {
    		trace("Finished: " + clipRef._name);
    		clipRef._parent.tweenNextRelease(); // keep cycling
    	};
    
    }
    Screwed up the reference in the event handler. Oh well.
    If it ain't broke, don't fix it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center