flash Tween

import mx.transitions.Tween;
import mx.transitions.easing.*;
Stage.scaleMode = "noScale";
var aClass=[Back,Bounce,Elastic,Regular,Strong];
var aEasingMethod:Array=new Array();
//在aEasingMethod中放入每个缓动方法
for(i=0; i < aClass.length; i++){
  aEasingMethod.push(aClass[i].easeIn);
  aEasingMethod.push(aClass[i].easeOut);
  aEasingMethod.push(aClass[i].easeInOut);
}
//定义初始变量
var nX=10;
var Y=200;
var oClips:Object=new Object();
建立侦听器
var tListener:Object=new Object();
tListener.onMotionFinished=function(twObject:Tween){
  //缓动结束时按原路径返回
  twObject.yoyo();
}
for(i=0; i < aEasingMethod.length; i++){

  depth=this.getNextHighestDepth();
  mClip=this.attachMovie("ball","ball"+i,depth,{_x:nX,_y:Y});
  //设置x坐标
  nX+=mClip._width+10;
  if(nX>=Stage.width-_root["ball0"]._width){
   nX = 10;
   Y += 20;
  }
  //将一个缓动方法添加到oClips对象
  oClips[mClip._name]=aEasingMethod[i];
  trace("ball"+i + ": " + mClip);
  //当用户点击时开始_y属性的补间
  mClip.onPress=function(){
    var twMove:Tween = new Tween(this,"_xscale",oClips[this._name],20,800,4,true);
    //添加侦听器
    twMove.addListener(tListener);
 var twMove:Tween = new Tween(this,"_yscale",oClips[this._name],20,800,4,true);
    //添加侦听器
    twMove.addListener(tListener);
 trace(this._name);
  }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值