var w:Number = Stage.width; var h:Number = Stage.height; var star:MovieClip;
//版本檢測(cè) check var versionNums:Array = $version.toString().split(" "); inform.text = (Number(versionNums[1].substr(0,1)) < 8) ? "You need the Flash 8 player to view this movie!" : "" ;
//Create children var sourceMC:MovieClip = this.createEmptyMovieClip("sourceMC", this.getNextHighestDepth()); var destMC:MovieClip = sourceMC.createEmptyMovieClip("destMC", sourceMC.getNextHighestDepth()); var screenShot = new flash.display.BitmapData(w, h, true, 0); //-------------------------------------------| destMC.onEnterFrame = function() { drawStar(); capture(); drawToScreen(); } //-------------------------------------------| function drawStar() { star = sourceMC.attachMovie("star", "star", 1); //attach at 1 glow.color = Math.floor(Math.random()*0xFFFFFF); star.filters = [glow,bevel]; star._x = getRandomInt(w, (star._width/2)); star._y = getRandomInt(h, (star._height/2)); } //-------------------------------------------| function capture() { destMC._visible = false; screenShot.draw(sourceMC); destMC._visible = true; } //-------------------------------------------| function drawToScreen() { destMC.attachBitmap(screenShot, 1); //attach at 1 } //-------------------------------------------| function getRandomInt(max, sub):Number { return Math.floor(Math.random() * ((max+1)-(sub*2)) + sub); }