开发者

how to animate the movie clip on click on button in Flash AS2.0

i design 5 button in flash home, about, profile, gallery, contact with a movie clip symbol on right side. now i want when i click on hom开发者_运维百科e button the movie clip come to home button on same position at right side, same when i click on about it comes to about & same for other buttons. please help me & let me know how it is possible with action script 2.0.


You need to make tweens. Better than a example, look at this tutorial :

http://www.actionscript.org/resources/articles/170/1/Flash-MX-2004-Undocumented-TweenEasing-Classes-Documented/Page1.html


You need to change the:

var begin = 20;
var end = 380;

These values represent the begin and end X position of the ball in the stage. If you have your buttons for example in X = 50 ; y = 100; The example should be:

myButton_btn.onRelease = function() {
        tweenBall(mx.transitions.easing.Bounce.easeOut);
};
function tweenBall(easeType) {
        var begin_x = 470; //This should be the initial X position of the mc that you want to animate
        var end_x = 50;
        var begin_y = 100; //This should be the initial Y position of the mc that you want to animate
        var end_y = 100; 
        var time = 20;
        var mc = ball_mc;
        ballTween = new mx.transitions.Tween(mc, "_x", easeType, begin_x, end_x, time);
        ballTween = new mx.transitions.Tween(mc, "_y", easeType, begin_y, end_y, time);
}

Hope it Helps !!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜