No ideas on this one? On Wed, Jun 17, 2009 at 12:00 PM, Pan Troglodytes <chimpathe...@gmail.com>wrote:
> I have a test program that, as far as I can tell, does the same thing using > an MXML component and the equivalent actionscript. When I click on the > button to execute the AS version, everything is fine. But when I click on > the button to execute the MXML version, I get a layout flicker. It's bad > enough that if you try to click on the MXML button over and over really > fast, you'll wind up clicking the main app and the menu will go away. > Here's the code: > > > <?xml version="1.0" encoding="utf-8"?> > <Application > xmlns="http://www.adobe.com/2006/mxml" > layout="absolute" > > > <Script> > <![CDATA[ > import mx.containers.GridItem; > import mx.controls.Label; > import mx.controls.DateField; > private function addCategoryAS():void > { > var gi:GridItem; > var gr:GridRow = new GridRow; > > gi = new GridItem; > gr.addChild(gi); > gi.addChild(new Label); > > addRow(gr); > } > > private function addCategoryMXML():void > { > var gr:GridRow = new TestGridRow; > gr.initialize(); // this is just to try to make it equivalent - > doesn't change flicker > > addRow(gr); > } > > private function addRow(gr:GridRow):void > { > grid.addChildAt(gr, 0); > > var gi:GridItem; > > gi = gr.getChildAt(0) as GridItem; > (gi.getChildAt(0) as Label).text = "item " + grid.numChildren + > ":"; > > gr.validateSize(true); > var verticalGap:Number = grid.getStyle("verticalGap"); > popup.scrollRect = new Rectangle(0, 0, Math.max(popup.width + > gr.measuredWidth), > popup.height + gr.measuredHeight + (isNaN(verticalGap) ? 0 : > verticalGap)); > if (popup.localToGlobal(new Point(0, 0)).y < > popup.owner.localToGlobal(new Point(0, 0)).y) > popup.y -= gr.measuredHeight + (isNaN(verticalGap) ? 0 : > verticalGap); > } > ]]> > </Script> > > <Canvas bottom="0"> > <PopUpButton id="myPopupButton" openAlways="true"> > <popUp> > <Canvas id="popup"> > <Grid id="grid" paddingTop="4" paddingBottom="4" paddingLeft="4" > paddingRight="4" > fontSize="12" backgroundColor="0xFFFFFF" borderStyle="outset" > borderThickness="2" > > > <GridRow> > <GridItem> > <Button label="Add AS" click="addCategoryAS()"/> > <Button label="Add MXML" click="addCategoryMXML()"/> > </GridItem> > </GridRow> > </Grid> > </Canvas> > </popUp> > </PopUpButton> > </Canvas> > </Application> > > TestGridRow.mxml: > <?xml version="1.0" encoding="utf-8"?> > <GridRow xmlns="http://www.adobe.com/2006/mxml"> > <GridItem> > <Label/> > </GridItem> > </GridRow> > > > I've dug through the generated code and have not been able to find anything > that I think would account for the problem. This is frustrating, because > what I really want to do is a more complicated MXML component to make it a > lot nicer to add rows in my addCategory function. But I can't as long as > it's going to be so jittery. > > Thanks! > > -- > Jason > -- Jason