RSS
热门关键字:  安装  u盘  mysql  ADSL  Backtrack
当前位置 : 主页>平面设计>flash>

飘雪Flash动画简单制作

来源:本站 作者:科科 时间:11-19 19:51:47 浏览:

swf大小为550*400;

在flash里画一片雪,设为moveClip,起名snow,删除场景是的雪片,在库中链接,选“为第一帧导出”“为actionscript导出”起名snow,然后在第一帧写入如下代码即可:

var t:Timer;
t = new Timer(1000,10);
t.addEventListener(TimerEvent.TIMER,xue);
t.start();
function xue(e:TimerEvent):void {
        var i:int;
        for (i=0; i<=10; i++) {
                var tt:snow=new snow();
                addChild(tt);
                 var sj:uint=Math.random()*5>>0;
                tt.x=Math.random()*550>>0;
             tt.y=Math.random()*400>>0;
                tt.width=sj;
                tt.height=sj;
                //tt.alpha=10;
                tt.addEventListener(Event.ENTER_FRAME,moveY);
        }
}
function moveY(e:Event) {       
        var speed:uint=e.target.width+Math.random()*1>>0;
        e.target.y+=speed;       
        if (e.target.y>400) {
                e.target.y=0;
        }
}

发布后效果自己感觉不错


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名评论
立即注册账号