package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.Timer;
import flash.geom.Matrix;
[SWF(width=800, height=465,backgroundColor=0xffffff, frameRate=24)]
public class main extends Sprite {
private var pointNum:Number=0;
private var pTxt:TextField = addChild(new TextField()) as TextField;
private var matrix:Matrix = new Matrix();
public function main(){
var t:Timer = new Timer(500);
var tFun=function(){matrix.createGradientBox(800,465,Math.PI/2,0,0),graphics.beginGradientFill(GradientType.LINEAR,[0x00CCFF,0xFFFFFF],[0.3,1],[0,255],matrix),graphics.drawRect(0,0,800,465),t.addEventListener(TimerEvent.TIMER,function(e){var mc;
var mcFun = function(){mc=addChild(new balloon(Math.random()*10 + 1)),mc.x=Math.round(Math.random()*(700-30))+30,mc.y=465}.apply();
mc.addEventListener(MouseEvent.MOUSE_DOWN, function(e){removeChild(e.target.parent),pTxt.htmlText='Score:'+(++pointNum).toString()+''});}),t.start()}.apply();
}
}
}
import flash.display.Sprite;
import flash.events.Event;
class balloon extends Sprite{
private var speed:Number;
private var s:Sprite =addChild(new Sprite()) as Sprite;
public function balloon(_t){
var sFun=function(){s.graphics.lineStyle(1, 0),s.graphics.curveTo(-10, 30, 0, 60),s.graphics.beginFill(Math.random() * 0xffffff + 0xff000000),s.graphics.drawCircle(0,0,20),speed=Math.round(_t)}.apply();
s.addEventListener(Event.ENTER_FRAME,function(e){s.y-= speed;});
}
}
|