On 9/30/05, flexhansen <[EMAIL PROTECTED]> 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 --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/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/