飞机移动缓动类,深藏于心的精华

//舞台上增加一个mc,实例名:jiba
stage.addEventListener(Event.ENTER_FRAME,enter_frameHandler);
stage.addEventListener(MouseEvent.CLICK,clickHandler);

var sx:Number = 0;
var sy:Number = 0;

function clickHandler(evt:MouseEvent):void

 sx = evt.stageX;
 sy = evt.stageY;
 trace("click:" + sx + "," + sy);
 
 
}

var juliX:Number = 0;
var juliY:Number = 0;

function enter_frameHandler(evt:Event):void
{
 juliX = sx - jiba.x;
 jiba.x = jiba.x + juliX/3;
 
 juliY = sy - jiba.y;
 jiba.y = jiba.y + juliY/3; 
 
}

 

 

posted on 2009-08-17 10:26  jiahuafu  阅读(217)  评论(0编辑  收藏  举报

导航