[Flash基础理论课10] 缓动效果 [Tween类]
2009-05-30 12:09:29 来源:WEB开发网实例2:飞入菜单
思路:1.初始化时把mc放到舞台外,这样才能出现飞入效果;
步骤1:
步骤2:
加入AS代码(注释的new Tween()部分请大家可替换后试试效果):
import mx.transitions.Tween;
import mx.transitions.easing.*;
//导入Tween类及其方法
mc._x = 1000;
mc._yscale = 10;
//设置mc的初始位置和高度
in_btn.onRelease = function() {
//飞入效果
new Tween(mc, "_yscale", Bounce.easeOut, mc._yscale, 100, 4, true);
//mc._yscale放大到100
new Tween(mc, "_x", Back.easeOut, mc._x, Stage.width/2, 5, true);
//mc._x移动到舞台宽度的一半(即舞台中心)
//new Tween(mc, "_x", Bounce.easeOut, mc._x, Stage.width/2, 5, true);
//new Tween(mc, "_x", Elastic.easeOut, mc._x, Stage.width/2, 5, true);
//new Tween(mc, "_x", Regular.easeOut, mc._x, Stage.width/2, 5, true);
//new Tween(mc, "_x", Strong.easeOut, mc._x, Stage.width/2, 5, true);
//new Tween(mc, "_x", None.easeNone, mc._x, Stage.width/2, 5, true);
};
out_btn.onRelease = function() {
//飞出效果
new Tween(mc, "_yscale", Bounce.easeIn, mc._yscale, 50, 3, true);
//mc._yscale缩小到50
new Tween(mc, "_x", Elastic.easeIn, mc._x, -1000, 5, true);
//mc._x移动到-1000(即舞台外部)
//new Tween(mc, "_x", Bounce.easeOut, mc._x, -1000, 5, true);
//new Tween(mc, "_x", Elastic.easeOut, mc._x, -1000, 5, true);
//new Tween(mc, "_x", Regular.easeOut, mc._x, -1000, 5, true);
//new Tween(mc, "_x", Strong.easeOut, mc._x, -1000, 5, true);
//new Tween(mc, "_x", None.easeNone, mc._x, -1000, 5, true);
};
- ››FLASH不等于运算符!=的使用实例
- ››FLASH不全等运算符!==
- ››FLASH字符串分隔符运算符
- ››FLASH% 模运算符
- ››Flash+、++、+= 加法运算符
- ››Flash, 逗号运算符
- ››flash中的-、--、-=减法运算符
- ››Flash的-Infinity 常数、.点运算符、/ 除法运算符...
- ››Flash两种注释方法/*..*/ 和// 注释行分隔符运算符...
- ››Flash的/=除法赋值运算符、=赋值运算符、== 等于运...
- ››Flash之?: 条件运算符、^ 按位 XOR 运算符、^= 按...
- ››Flash的_framesloaded代码示例
更多精彩
赞助商链接