package {
import flash.display.MovieClip;
import com.MarhR;
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
public class shuzitiandi extends Sprite {
public function shuzitiandi() {
// constructor code
init();
}
public function movenum():Sprite
{
var s:Sprite=randnum();
addChild(s);
s.x=200;
s.y=250;
s.alpha=Math.random();
s.scaleX=s.scaleY=Math.random()*0.5+0.5;
s.addEventListener(Event.ENTER_FRAME,movez);
var i:Number=MarhR.Random(360);
var A=MarhR.Random(50)+40;
function movez(ee:Event):void
{
i+=5;
s.y-=1;
s.x=200+A*Math.sin(i*Math.PI/180);
if(s.y<0)
{
s.x=200;
s.y=250;
A=MarhR.Random(50)+40;
}
}
return s;
}
public function randnum():Sprite
{
var la:TextField=new TextField();
la.width=12;
la.textColor=0xffffff;
la.addEventListener(Event.ENTER_FRAME,mnum);
function mnum(evt:Event):void
{
evt.target.text=MarhR.Random(10);
}
var sp:Sprite=new Sprite();
sp.addChild(la);
return sp;
}
public function init():void
{
var j:int=0;
stage.addEventListener(Event.ENTER_FRAME,enterframe);
function enterframe(ee:Event):void
{
if(j%3==0)
{
var moves:Sprite=movenum();
addChild(moves);
}
j++;
if(j==270)
{
stage.removeEventListener(Event.ENTER_FRAME,enterframe);
}
}
}
}
}