The following application works as expected in FlexBuilder 2.0.1. When click the Click Me button, a dynamically created Update button appears 10 pixels from the bottom. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " layout="absolute"> <mx:Script> <![CDATA[ private function doit():void { var newButton:Button = new Button(); newButton.label = "Update"; newButton.setStyle("bottom", 10); addChild(newButton); } ]]> </mx:Script> <mx:Button label="Click Me" click="doit()"/> </mx:Application>
- Gordon ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of darylgmyers Sent: Tuesday, February 13, 2007 5:00 AM To: [email protected] Subject: [flexcoders] Re: Using setSyle on dynamic created button not working Gordon, Thanks for your suggestion. I tried 10 insteead of "10" and it still doesn't work. I'm trying to set other style properties as well and they do not seem to work on a dynamically created item. --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Gordon Smith" <[EMAIL PROTECTED]> wrote: > > It would be > > newButton.setStyle("bottom", 10); > > because the 'bottom' style has type Number. > > - Gordon > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of darylgmyers > Sent: Friday, February 09, 2007 1:46 PM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Using setSyle on dynamic created button not > working > > > > I'm creating a number of objects dynamically in actionscript. then I'm > using setStyle to set certain styles before addChild actually adds the > object to the container. The setStyle is not working. Below is a > small piece of the code. > > varnewButton:Button = new Button; > newButton.label="Update"; > newButton.setStyle("bottom","10"); > newButton.addEventListener(MouseEvent.CLICK,clickUpdate); > newHBox.addChild(newButton); >

