标签:
//第一帧响应事件
import flash.events.Event;
addEventListener(Event.ENTER_FRAME,webcyz);
function webcyz(e:Event)
{
var xuehua:xue= new xue();
xuehua.alpha = Math.random()+0.5;
xuehua.height = xuehua.width = Math.random()*6+5;
xuehua.x=Math.random()*550;
piaoxuekongjian.addChild(xuehua);
for(var i:int=0;i<piaoxuekongjian.numChildren;i++)
{
var mc:xue = xue(piaoxuekongjian.getChildAt(i));
if(mc.y>420)
{
piaoxuekongjian.removeChild(mc);
i--;
}
else
{
mc.y+=Math.random()*5+2;
mc.x+=(Math.random()-.5)*10;
}
}
//雪花类,继承自影片剪辑
package {
import flash.display.MovieClip;
public class xue extends MovieClip {
public function xue() {
// constructor code
}
}
}
}
标签:
原文地址:http://www.cnblogs.com/webcyz/p/5763381.html