flash on 2011-10-18

by riafeed
♥0 | Line 48 | Modified 2011-10-18 00:29:11 | MIT License
play

ActionScript3 source code

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

package
{
    import flash.display.Sprite;
    import flash.display.AVM1Movie;
    import mx.core.Application;
    import mx.events.FlexEvent;
    import mx.styles.StyleManager;
    import mx.styles.CSSStyleDeclaration;
    import mx.controls.Button;
    import mx.skins.halo.HaloBorder;
    import flash.display.Bitmap;
    import flash.display.Sprite;
    import flash.events.Event;

    public class Main extends Sprite
    {
        /*
        [Embed(source="../library/up.png")]
        public var UpState        : Class;
        [Embed(source="../library/over.png")]
        public var OverState    : Class;
        [Embed(source="../library/down.png")]
        public var DownState    : Class;
        */

        public function Main()
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }

        public function init() {
            //this.layout = "absolute";
            //setupStyles();
            var button : Button = new Button();
            button.label = "labelBtn";
            addChild( button );
        }

        private function setupStyles() : void
        {
            var style:CSSStyleDeclaration = new CSSStyleDeclaration();
            style.setStyle( "borderSkin", mx.skins.halo.HaloBorder );
            //StyleManager.setStyleDeclaration( "Application", style, false );

            style = new CSSStyleDeclaration();
            style.setStyle( "textAlign", "left" );
            style.setStyle( "fontAntiAliasType", "advanced" );
            style.setStyle( "fontGridFitType", "pixel" );
            style.setStyle( "paddingLeft", 10 );
            style.setStyle( "paddingRight", 10 );
            style.setStyle( "paddingTop", 5 );
            style.setStyle( "paddingBottom", 5 );
            style.setStyle( "horizontalCenter", 0 );
            style.setStyle( "verticalCenter", 0 );
            //style.setStyle( "upSkin", UpState );
            //style.setStyle( "overSkin", OverState );
            //style.setStyle( "downSkin", DownState );

            //StyleManager.setStyleDeclaration( "Button", style, false );
        }

        private function handleComplete( event : FlexEvent ) : void
        {
            var button : Button = new Button();
            button.label = "labelBtn";
            addChild( button );
        }
    }
}