Test

by FelixT forked from flash on 2010-3-23 (diff: 47)
♥0 | Line 61 | Modified 2010-11-18 05:44:25 | MIT License
play

ActionScript3 source code

/**
 * Copyright FelixT ( http://wonderfl.net/user/FelixT )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/57Zq
 */

// forked from hacker_9p8x8mco's flash on 2010-3-23
package {
    import flash.display.Sprite;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.Event;
    import flash.events.MouseEvent;
    [SWF(width=500, height=500, backgroundColor=0xF5F5F5F, frameRate=30)]
    public class FlashTest extends Sprite {
            public var gomokuform:GomokuForm;
        public function FlashTest() {
            
            this.gomokuform = new GomokuForm();
            addChild(this.gomokuform);
        }
    }
}



import flash.display.Graphics;
import flash.display.Sprite;
import flash.text.TextField;
    
class GomokuForm extends Sprite{
    public var tf_desc:TextField;
    public var squares:Array = new Array();
    
    public function GomokuForm(){
        this.createBoard();        
    }
    public function createBoard():void{
        this.tf_desc = new TextField;
        this.tf_desc.text = "Hello World!";
        this.addChild(this.tf_desc);
        var x:int;y:int;
        for(y = 0;y < 11; y++){
            var ar:Array = new Array;
            this.squares.push(ar);
            for(x = 0; x < 11; x++){
                var sq:Square = new Square();
                ar.push(sq);
                this.addChild(sq);
                sq.x = x * 30;
                sq.y = y * 30 + 20;
                sq.xpos = x;
                sq.ypos = y;        
            }
        }    
    }
}



import flash.display.Graphics;
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.GradientType;
import flash.geom.Matrix;
class Square extends Sprite{
    public var xpos:int;
    public var ypos:int;
    public var status:String = "BLANK";

    public function Square(){
        var g:Graphics = this.graphics;
        g.beginFill(Math.random()*0xFFFFFF);
        g.lineStyle(1,0);
        g.drawRect(0,0,30,30);
        g.endFill();
    }
}