flex test
Using Flex 3 Component without MXML - only AS3
http://filt3r.free.fr/index.php/2007/08/11/28-using-flex-3-component-without-mxml-only-as3
// Using Flex 3 Component without MXML - only AS3
// http://filt3r.free.fr/index.php/2007/08/11/28-using-flex-3-component-without-mxml-only-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 );
}
}
}