[Test]MinimalComps0.9.6 Window

by okoi
♥0 | Line 44 | Modified 2012-03-07 10:22:59 | MIT License
play

ActionScript3 source code

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

/**
 * [Test]MinimalComps0.9.6 Window
 */
package 
{
    import com.bit101.components.Label;
    import com.bit101.components.Window;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.events.Event;
    
    [SWF(width = "465", height = "465", frameRate = "60")]
    
    
    /**
     * ...
     * @author okoi
     */
    public class Main extends Sprite 
    {
        public static const WIDTH:int = 465;
        public static const HEIGHT:int = 465;
        
        private var window1:Window;
        private var window2:Window;
        private var label:Label;
        
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            var back:BitmapData = new BitmapData( WIDTH, HEIGHT, true, 0xffffffff );
            var x:uint, y:uint;
            for ( y = 0; y < HEIGHT; y += 4 ) {
                for ( x = 0; x < WIDTH; x++ ) {
                    back.setPixel32( x, y, 0xffdcdcdc );
                }
            }
            addChild( new Bitmap( back ) );
            
            
            window1 = new Window( this, 0, 0, "window1" );
            window1.width = 400;
            window1.height = 400;
            window1.alpha = 0.8;
            window1.hasMinimizeButton = true;
            
            window2 = new Window( window1.content, 20, 20, "window2" );
            window2.width = 300;
            window2.height = 100;
            
            label = new Label( window2.content, 10, 10, "Wonderfl" );
        }
        
    }
    
}