2 Replies Latest reply on Oct 30, 2009 6:58 AM by DennisTh

    addChild doesn't effect for some reason REFdn2065133102


      In small test application I have the follow object… stack


      The “Main.mxml” loads the EntryClass.as -> “class EntryClass” (that doesn’t extends anything) -> “public static function Main()”.


      This EntryClass.Main() function is doing the follow:


            var mxmlApp:Application = Application(Application.application);

            var mainAppClass:MainAppClass=new MainAppClass();



      So the mainAppClass is loaded.

      Now the MainAppClass extends the UIComponent and in its constructor does this:


            var buttonFromMainClass:Button=new Button();

            buttonFromMainClass.x=20;buttonFromMainClass.y=20;buttonFromMainClass.label="hello world";


      to add it to stage I call




      and here is the problem! The button is not appeared on the stage, but using this code:




      the button is added to the stage and it is visible.


      Why the button is not added to the stage with the simple addChild? Where am I wrong?


      Something that might be help, in EntryClass.Main() if I create a button and add it with the mxmlApp.addChild, the button is added and appeared on the stage normally, so there is no problem with the use of mxmlApp.addChild.


      Best regards