[AS3] Flex no MXML using Application

[as3]
package
{
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;

public class Main extends Application
{
[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()
{
super();

this.layout = "absolute";
this.addEventListener(FlexEvent.CREATION_COMPLETE, handleComplete);

setupStyles();
}

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 );
}
}
}
[/as3]

Posted in: AS3