views:

12

answers:

1

I managed to put texts on screen now I want to show the text after the button is clicked but the button does not appear.

Here is the code.

   package 
   {
    import flash.events.MouseEvent;
    import flash.media.Camera;
    import mx.controls.Button;
    import flash.display.Sprite;
    import flash.text.TextField;

    public class test2 extends Sprite 
    {
           private var tField:TextField;

         public function click(e:MouseEvent):void
         {
            tField = new TextField();
            tField.text="ffff";
            addChild(tField);
        }
           public function test2():void 
           {
            var aa:Button=new Button();
            aa.label="deneme";
            aa.x=100;
            aa.y=200;
            aa.addEventListener(MouseEvent.CLICK, click)
           }
    }
   }
+1  A: 

You need to alter the test2 function to actually add the button to the stage:

addChild(aa);
frankhermes