背景图随鼠标上下左右移动显示效果

import com.greensock.TweenLite;    //TweenLite 库需要自己下载

addEventListener(MouseEvent.MOUSE_MOVE,mouseCoordinate);

private function mouseCoordinate(event:MouseEvent):void{
    var xn:int = mouseX / stage.stageWidth * (stage.stageWidth - court.width);
    var yn:int = mouseY / stage.stageHeight * (stage.stageHeight -court.height);
    TweenLite.to(court,1,{x:xn,y:yn});

}

//court为移动的内容

 

posted on 2013-12-30 21:07  DerekYu  阅读(1537)  评论(0)    收藏  举报

导航