flash on 2012-6-8
♥0 |
Line 41 |
Modified 2012-06-08 14:37:01 |
MIT License
archived:2017-03-20 15:18:01
ActionScript3 source code
/**
* Copyright jokehn9 ( http://wonderfl.net/user/jokehn9 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/jC9J
*/
package {
import flash.events.Event;
import flash.display.Shape;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var bullet:Shape = makeBullet();
addChild(bullet);
var arr:Array = [];
addEventListener("enterFrame",fc)
function makeBullet():Shape {
var bullet:Shape = new Shape();
bullet.graphics.beginFill(0x0);
bullet.graphics.drawCircle(0,0,6);
var ind:int = (Math.random() * 4);
if( ind == 0) {
bullet.x = 465;
bullet.y = 465*Math.random()
}
else if( ind == 1) {
bullet.x = 0;
bullet.y = 440*Math.random()
}
else if( ind == 2) {
bullet.y = 0;
bullet.x = 440*Math.random()
}
else if( ind == 3) {
bullet.y = 465;
bullet.x = 440*Math.random()
}
arr[arr.length] = bullet;
return bullet
}
function fc(e:Event):void {
var B:Shape = makeBullet();
addChild(B)
}
}
}
}