gamania2395 發表於 2012-7-27 08:24 AM
您好,我已經傳給您了!!
真的很感謝大大的幫忙
改好了,這是ActionScript 3.0的語法:- import fl.transitions.Tween;
- import fl.transitions.easing.*;
- import fl.transitions.TweenEvent;
- btn.x = range.x;
- btn.y = range.y;
- as1(btn,range.x,range.x+range.width-btn.width,range.y,range.y+range.height-btn.height);
- function xy(x:Number,y:Number)
- {
- var a:Number;
- a=Math.round(Math.random()*(y-x))+x;
- return a;
- }
- function as1(mc:MovieClip,xbegin:Number,xend:Number,ybegin:Number,yend:Number)
- {
- var a:Number = xy(xbegin,xend);
- var b:Number = xy(ybegin,yend);
- var c:Number = 0;
- var d:Number = Math.abs(a - mc.x) / 200;
- var tweenx:Tween = new Tween(mc,"x",Strong.easeOut,mc.x,a,d,true);
- var tweeny:Tween = new Tween(mc,"y",Strong.easeOut,mc.y,b,d,true);
- tweeny.addEventListener(TweenEvent.MOTION_FINISH, fh);
- function fh(){
- if (c<100) {
- as1(mc, xbegin, xend, ybegin, yend);
- c++;
- }
- }
- }
複製代碼 ... |