I think you may need to separate out your styles and properties.  For example width and height should be in that object and done as numbers (you have them in quotes which means strings).  But the margins and borderStyles and colors are all styles and need to be applied using setStyle I believe.

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Noah Hoffman
Sent: Tuesday, September 27, 2005 10:53 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Dynamically created children don't respect properties?

 

Hello,

 

I’ve got some code that’s creating a bunch of nested tags based on the results of a RemoteObject call.  The problem is, none of the width or height settings are working (or I’m missing something else).  Does anyone have any ideas?  When the code below gets rendered, I’d expect a bunch of repeating HBox’s to appear in the VBox “vbDynamicStudies “.  What I get instead is a huge blank panel with hscroll and vscroll bars that are almost infinitely long.  In order to debug I’ve tried setting explicit widths (like 100) and heights and have proven that the nested tags are created properly, it’s just the layout that’s messed up.  Any one have any ideas?

 

Thanks,

Noah

 

 

<mx:Panel

        xmlns:mx="http://www.macromedia.com/2003/mxml"

        xmlns:comp="components.*" 

        initialize="initComponent()"

        marginTop="3"

        marginLeft="5"

        marginRight="5"  creationPolicy="all"

        creationComplete="creationComplete()"

        >

 

        <mx:Script>

        <![CDATA[

 

                    for(var n = 0; n < iterations; n++)

                    {                                              

                                myHbox = null;

                                myHboxSub = null;

                                myVbox = null;

                               

                                myHbox = HBox(vbDynamicStudies.createChild(HBox, undefined,

                                                                                { marginTop:"10",

                                                                                  marginBottom:"10",

                                                                                  marginLeft:"10",                                                                                               

                                                                                  backgroundColor:"#FFFFFF",

                                                                                  mouseOver:"changeBgColor(event, rollOverColor)",

                                                                                  mouseOut:"changeBgColor(event, bgColor)",

                                                                                  borderStyle:"solid" }));                        

 

                                myHboxSub = HBox(myHbox.createChild(HBox, undefined,

                                                                                  { backgroundColor:"#CCCCCC",

                                                                                            width:"160",

                                                                                            height:"75",

                                                                                            borderStyle:"solid",

                                                                                            borderThickness:"2",

                                                                                            verticalAlign:"middle",

                                                                                            horizontalAlign:"center" }));

                               

                                myHboxSub.createChild(Text, undefined,

                                                                                { text:"Image Placeholder",

                                                                                  textAlign:"center",

                                                                                  width:"100%",

                                                                                  height:"160" });

       

                                myVbox = VBox(myHbox.createChild(VBox, undefined, { width:"100%" } ));

                   

                                myVbox.createChild(Text, undefined,

                                                                    { text:"arResults[n].title",

                                                                      fontWeight:"bold",

                                                                      fontSize:"12",

                                                                      width:"100%" });

       

                                myVbox.createChild(Text, undefined,

                                                                    { text:"arResults[n].description",

                                                                      fontSize:"10",

                                                                      width:"100%" });          

                                                                                                         

                                }          

                   

    ]]>

    </mx:Script>                                    

 

 

<mx:VBox id="vbDynamicStudies" width="100%" >

        </mx:VBox>

 

</mx:Panel>

 

 

 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to