Finally got it to work, thought I would offer the code to anybody who wants this in Flex 2.
I changed it a little bit, I made a custom component that extends Box (called FBox... F for Flow). Anyway, not sure how flexible it is, but it should be a good start for somebody looking to do something like this. package com.myComponents.ui { import mx.containers.Box; import mx.core.EdgeMetrics; import mx.core.UIComponent; public class FBox extends Box { public function FBox() { super(); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); var vm:EdgeMetrics = viewMetricsAndPadding; var lastX:Number = vm.left; var lastY:Number = vm.top; var rowHeight:Number = 0; for (var i:Number = 0; i < numChildren; i++) { var child:Object = getChildAt(i); if (lastX + child.width > unscaledWidth - vm.right) { lastX = vm.left; lastY += rowHeight; } child.move(lastX, lastY); lastX += child.width; rowHeight = Math.max(rowHeight, child.height); } } } } --- In flexcoders@yahoogroups.com, "klumikaze" <[EMAIL PROTECTED]> wrote: > > I've been trying to get the Flow.as code working in Flex 2... > > I've discovered that layoutChildren() is now updateDisplayList() and > that the Container class is now under mx.core. > > Can anybody point me in the right direction for something else that > might have changed? Or even if there is a new way to do this with the > new Flex 2 containers. > > Thanks for your time, > > Brian > > > --- In flexcoders@yahoogroups.com, Manish Jethani <manish.jethani@> > wrote: > > > > On 9/30/05, flexhansen <borendex@> wrote: > > > > > Is there an easy way to achieve mx:Tile behaviour but without the > > > tiles being of equal size? > > > > > > In other words I'm looking for something like the div-tag of plain old > > > html that wraps content to fit the width prop. instead of putting up > > > scrollbars. > > > > You mean flow layout? > > > > // Flow.as > > > > /** > > * Implements flow layout for Flex. > > */ > > class Flow extends mx.containers.Container > > { > > public function layoutChildren():Void > > { > > var vm:Object = getViewMetricsAndMargins(); > > > > var lastX:Number = vm.left; > > var lastY:Number = vm.top; > > > > var rowHeight:Number = 0; > > > > for (var i:Number = 0; i < numChildren; i++) > > { > > var child:Object = getChildAt(i); > > > > if (lastX + child.preferredWidth > layoutWidth - vm.right) > > { > > lastX = vm.left; > > lastY += rowHeight; > > } > > > > child.move(lastX, lastY); > > > > lastX += child.preferredWidth; > > rowHeight = Math.max(rowHeight, child.preferredHeight); > > } > > > > super.layoutChildren(); > > } > > } > > > > You should also override the 'measure' method to enable the container > > to correctly measure itself. The above code only does the job of > > laying out (which is okay if you're always specifying a width and > > height explicitly). > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/