just for the record, i figured it out after reading 'creating advanced
components', as manish mentioned originally the measure method has to
be overridden, so that the _measuredPreferredWidth and
_measuredPreferredHeight are set according to your layout wishes.

i include my modified code....

ed


// Flow.as

/**
* Implements flow layout for Flex.
* from original source by Manish Jethani of Macromedia
*/
class Flow extends mx.containers.Container
{
        /*      measure
         *      note: height has to be specified in pixels at the moment
         * 
         *  measure is like a dry run at laying out the children and setting
_measured variables
         *  once these are set, then the component will draw properly.
         */
        private function measure( Void ): Void
        {
                var vm:Object = getViewMetricsAndMargins();
                
                var lastX:Number = vm.left;
                var lastY:Number = vm.top;
                
                var columnWidth:Number = 0;
                
                for (var i:Number = 0; i < numChildren; i++)
                {
                        var child:Object = getChildAt(i);
                
                        if (lastY + child.preferredHeight > layoutHeight - 
vm.bottom)
                        {
                                lastX += columnWidth + 
getStyle("horizontalGap") ;
                        }
        
                        lastY += child.preferredHeight;
                
                        columnWidth = Math.max(columnWidth, 
child.preferredWidth);
                }
                
                _measuredPreferredWidth = lastX;
                _measuredPreferredHeight = layoutHeight;
                
        }
        
        
        private function layoutChildren():Void
        {
                var vm:Object = getViewMetricsAndMargins();
                
                var lastX:Number = vm.left;
                var lastY:Number = vm.top;
                
                var columnWidth:Number = 0;
                
                for (var i:Number = 0; i < numChildren; i++)
                {
                        var child:Object = getChildAt(i);
                
                        if (lastY + child.preferredHeight > layoutHeight - 
vm.bottom)
                        {
                                lastX += columnWidth + 
getStyle("horizontalGap") ;
                                lastY = vm.top;
                        }
        
                        child.move(lastX, lastY);
        
                        lastY += child.preferredHeight;
                        
                        columnWidth = Math.max(columnWidth, 
child.preferredWidth);
                }
                super.layoutChildren();
        }
}








------------------------ 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/
 


Reply via email to