--- In flexcoders@yahoogroups.com, "dennis" <den...@...> wrote:
>
> 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();
> 
>       mxmlApp.addChild(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
> 
>  
> 
>       addChild(buttonFromMainClass);
> 
>  
> 
> and here is the problem! The button is not appeared on the stage, but using
> this code:
> 
>  
> 
>       Application(Application.application).addChild(buttonFromMainClass);
> 
>  
> 
> 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?

This seems like a roundabout and probably inadvisable way to do this, but you 
might want to try calling setActualSize() on buttonFromMainClass.

If that doesn't work, post back with more info on when and how you're 
instantiating the class.

HTH;

Amy

Reply via email to