Maybe give the boxes an initial visibility of false and then in creationComplete set the visibility to true?

 


From: [email protected] [mailto:[email protected]] On Behalf Of edeustace
Sent: Wednesday, November 02, 2005 9:39 AM
To: [email protected]
Subject: [flexcoders] Flow.as from "Re: <div> like behaviour?"

 

hello,
i have been using flow.as (see below), and it works great. however
there is something that i'd like to fix.
firstly i have bound a showEffect and hideEffect to it which increases
the width over a time period:

<mx:Effect>
      <mx:Resize name="shrink" widthTo="0" duration="300" />
      <mx:Resize name="grow" widthTo="400" duration="300" />
</mx:Effect>


the problem is, that when initialising the box, all the subelements
are visible for a brief instant when the page loads, then they
disappear and display themselves as expected. i'm guessing there is
some chain of command is broken. here is the tag for the flow box:

<Flow id="flowBox"  visible="false"
creationComplete="showSearch(event)" showEffect="grow"
hideEffect="shrink" 
                                                      horizontalGap="24" height="125"
                                                      vScrollPolicy="off" hScrollPolicy="off">
            <mx:HBox width="13" horizontalGap="0">
                  <mx:Spacer width="10"  />
                  <mx:VRule height="100%" />
                 
            </mx:HBox>
            <!-- the rest of the subelements are created in actionscript using
createChild() -->
</Flow>

if anyone could point me in the right direction i'd be very grateful,
yours
ed

--- In [email protected], Manish Jethani
<[EMAIL PROTECTED]> wrote:
>
> 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).
>







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