flash actionscript:
I'm just wondering if there is a way to make motion tweens using AS. Let's say I want to write a function that moves my_mc from point A to point B over X amount of time. Or I want to fade in my_mc over an X period of time. How would I do this?
Hello bwm_razel, Have you tried the tween class? It is in the documentation the Component Language Reference: ActionScript Class Name mx.transitions.Tween If you are using Flash 8 Pro. Hope that helps, -Ken Kenneth J. Toley Flash Support Team Lead Flash ActionScript/Application Architecture
No sorry, that class is only in Flash 8. You may want to consider a 3rd party library or perhaps a book on scripted animation. Flash MX 2004 Game design demystified is a good one. :D
Here is the code for Flash Player 7 Rich import mx.transitions.easing.Strong; import mx.transitions.Tween; easeType1 = mx.transitions.easing.Bounce.easeOut; easeType2 = mx.transitions.easing.Strong.easeOut; var scope = this; var baseDepths = -16000; //Tween var tweenMenus = function (menuToTween, whatToTween, speed, endLocation, functionToPlay) { delete menuTween; easeType = mx.transitions.easing.Strong.easeOut; var _local3 = this[menuToTween][whatToTween]; var end = endLocation; var _local2 = speed; var _local1 = this[menuToTween]; menuTween = new mx.transitions.Tween(_local1, whatToTween, easeType, _local3, end, _local2, true); menuTween.onMotionFinished = function() { scope[functionToPlay](); }; }; MovieClip.prototype.pauseScene = function(pauseFor) { var _local1 = this; _local1.stop(); _local1.createEmptyMovieClip("timerClip", baseDepths); timerClip.startTime = getTimer(); timerClip.pauseTime = pauseFor*1000; timerClip.onEnterFrame = function() { var _local1 = this; var _local2 = getTimer()-_local1.startTime; if (_local2>_local1.pauseTime) { _local1._parent.play(); delete _local1.onEnterFrame; _local1.removeMovieClip(); return; } }; }; tweenMenus(myClip, "_x", .75, 630, null);// myClip = mc - _x = property to Teween - .75 = speed - 630 = end location, null = function to call when done pauseScene(2); stop();
Don't see what you're looking for? Try a search.
|