You could set a timer using setInterval(), like so in Flex 1.5:

scrollTimer = setInterval(mx.utils.Delegate.create(this, doScroll), 
500, canvas);

Put the above into your autoScroll function, move your scrolling 
code into new function doScroll(canvas), and then add another new 
function that calls clearInterval(scrollTimer) and hook it up to 
your HBox's mouseOut event.  All that's left is to declare 
scrollTimer so that the functions can access it.

Hope that helps!

Doug

--- In [email protected], "ffej1138" <[EMAIL PROTECTED]> wrote:
>
> Maybe effect is the wrong word, but...
> 
> I have an HBox with a bunch of images in it. Now, the number of 
images
> exceeds the width I have for the box, so a scroll bar appears. No
> problem, right.
> 
> I want to make it so you can mouse over the leftmost or rightmost 
ends
> of the HBox and have it "auto scroll".
> 
> I have this code so far:
> <mx:Script>
> <![CDATA[
>  function autoScroll(canvas):Void {
>   var tolerance:Number = 100;
>   if (canvas.mouseX > canvas.width - tolerance)
>   canvas.hPosition += tolerance;
>   else if (canvas.mouseX < tolerance)
>   canvas.hPosition -= tolerance;      
>  }
> ]]>
> </mx:Script>
> 
> <mx:HBox height="300" width="400" id="myHBox" hScrollPolicy="on"
> mouseOver="autoScroll(event.target)">
> junk in HBox
> </MX:HBox>
> 
> this works great, except you have to mouse over the edge, then out,
> then over to continuously scroll. I want something that will auto
> scroll while the mouse is hovering over the edge of the box.
> 
> any ideas?
> 
> Thanks
> 
> Jeff
>







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