Is it absurd to try to code a simple app in pure as3 that uses flex
components like Button and Scrollbar?

I've been trying and ran into problems with a bug in the Flex
framework having to do with resources
(http://bugs.adobe.com/jira/browse/SDK-12205), used Rob Jellinghaus's
workaround, and came up with this simple code, below.

The sprite will draw itself, but the button does not show up.

Could anyone tell me if there's something basic I'm not understanding,
or am I making a simple dumb mistake?

Thanks!
Jack

package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.system.ApplicationDomain;
   
    import mx.containers.Canvas;
    import mx.controls.Button;
    import mx.controls.Label;
    import mx.core.Singleton;
   
    public class ShellAS3 extends Sprite
    {
       
        public function ShellAS3()
        {

            var resourceManagerImpl:Object =
flash.system.ApplicationDomain.currentDomain.getDefinition("mx.resources::ResourceManagerImpl");
           
Singleton.registerClass("mx.resources::IResourceManager",Class(resourceManagerImpl));
           
            init();
        }
        private function init():void{
           
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;

            var ball:Sprite = new Sprite();
            addChild(ball);
            ball.x = 20;
            ball.y = 100;
            ball.graphics.beginFill(0xff0000);
            ball.graphics.drawCircle(0,0,40);
            ball.graphics.endFill();

           
            var bt:Button = new Button();
            bt.x = 200;
            bt.y = 200;
            bt.width=100;
            bt.height = 20;
            bt.label = "Click";
            addChild(bt);

        }
    }
}



Reply via email to