If the mainStage is the MovieClip that is the root of a Flex movie, you can add a Button there, but in the general case you cannot, as Josh points out. That MovieClip is an instance of SystemManager, so if (mainStage is SystemManager) == false, then you have to find another way to parent.
There is a rule in Flex that components are sized by their parents (except for popups). That's why you will need to call setActualSize or set the width/height of the component. ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Josh Tynjala Sent: Friday, November 17, 2006 8:17 AM To: [email protected] Subject: Re: [flexcomponents] Creating Components on Runtime... Flex UIComponents like Buttons may only be added to other UIComponents. This does not include MovieClips. Your Button is probably not receiving important events and method calls that it normally would, so it's just not getting displayed. When you attach it to another UIComponent, there are some other things to consider. If that component is a Container, then I'm not sure why your Button is not appearing. However, if it's just a regular component, you need to manually tell the Button its size with the setActualSize method within the parent component's updateDisplayList method. Josh Tynjala www.zeuslabs.us <http://www.zeuslabs.us/>
