Help with scrollbars up and down arrows (w demo)

By m1a2x3x7 | Jun 25, 2009

actionscript3

Hey everyone. I have this app that displays RSS feeds and I created a custom scroll bar to view more RSS items.

This is one of those things where you have the entire app done and it’s live but the big man sees one thing and he wants it fixed.

Currently when you click the down or up arrow it moves the scrollbar and movieclip down or up 1px. We want to be able to hold down the down or up arrow and have it continuously move and when you let go it stops. I tried using a loop with a boolean var but my system crashes.

Can you help me with this issue?

Here is the demo of the app. (I hope it’s ok to post websites. I’m sorry if it’s not.)

http://indianapoliseconomicdevelopment.com/

The app is in the middle of the website on the right column and says "Business News from IBJ.com"

Here is the code I currently use to move the scrollbar down 1px when you click the down arrow.

ActionScript Code:
private function arrowDownClicked(event:MouseEvent):void         {             if(scrollBar_mc.y <= 165)             {                 //move the scrollbar                 scrollBar_mc.y = scrollBar_mc.y + 1;                 //move the movieclip depending on the location of the scrollbar                 var moved:Number = scrollBar_mc.y - 84;                 var pctMoved:Number = moved/82;                 var xmlMainMove:Number = pctMoved*179;                 xmlMain_mc.y = 61 - Math.round(xmlMainMove);                 //unlock the up arrow button                 arrowUp_mc.buttonMode = true;             }             //lock the down arrow button if scrollbar hit its limit             if(scrollBar_mc.y == 166)             {                 arrowDown_mc.buttonMode = false;             }         }

Thanks for the help.

-M

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0