package
{
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.Event;
import flash.events.TimerEvent;
public class shijian extends MovieClip
{
var timer:Timer;
public function shijian()
{
timer = new Timer(100);
timer.addEventListener(TimerEvent.TIMER,px);
timer.start();
}
function px(evt:TimerEvent):void
{
// 控制每次触发的时间 是TIMER类的一个属性
timer.delay = Math.random() * 150 +1040;
timer.start();
movepp();
}
function movepp():void
{
//PP 为一个水泡元件
var pp:PP = new PP();
pp.x =100;
pp.y = 350;
pp.scaleX = pp.scaleY = Math.random() * 2;
pp.alpha = Math.random() * 0.3 +0.5;
addChild(pp);
pp.addEventListener(Event.ENTER_FRAME,px1);
}
function px1(evt:Event):void
{
evt.target.x += Math.random() *5-2;
evt.target.y-= Math.random() *1;
}
}
}
联系客服