复制代码 代码如下: import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; var homeX:Number = -301; var homeY:Number = 110; var newsX:Number = -17; var newsY:Number = -777; var aboutX:Number = -1354; var aboutY:Number = -445; var xTween:Tween; var yTween:Tween; var inTween:Tween; var outTween:Tween; 先是导入一些需要用到的类,然后定义几个坐标,这几个坐标都是一个大mc的不同位置。
然后是初始化tween类,并对tween类监听。
复制代码 代码如下: xTween = new Tween(main_mc,"x",h3.easeInOut,main_mc.x,homeX,2,true); yTween = new Tween(main_mc,"y",h3.easeInOut,main_mc.y,homeY,2,true); inTween = new Tween(main_mc.home_mc,"alpha",None.easeNone,0,1,.5,true); outTween = new Tween(main_mc.home_mc,"alpha",None.easeNone,1,0,.5,true); xTween.addEventListener(TweenEvent.MOTION_FINISH,fadeIn); xTween.addEventListener(TweenEvent.MOTION_START,fadeOut); home_btn.addEventListener(MouseEvent.CLICK, navigate); news_btn.addEventListener(MouseEvent.CLICK, navigate); about_btn.addEventListener(MouseEvent.CLICK, navigate);