PDA

View Full Version : slide actionscript i need help



Voodoo
08-26-2004, 06:14 PM
Hi everybody
my problem is i want a slidebar with text in it wat goes a round in "so called scrollbar"how do i do that
example i want to display 10 words but i got the room for 6 en ik want to give the bar with my mouse to go to the right or to the left

PLEASE HELP THNX ALREADY

NTD
08-26-2004, 06:45 PM
Hi,

Paste this Actionscript into the first frame of your movie and create a movieclip named 'scrollMC'........


_root.onEnterFrame = function () {
trace(_root.scrollMC._x );
// set the scroll
if (_root._xmouse>300) {
_root.scrollMC._x -= 5;
&#125; else if &#40;_root._xmouse<300&#41; &#123;
_root.scrollMC._x += 5;
&#125;
//set the bounds
if &#40;_root.scrollMC._x<=-50&#41; &#123;
_root.scrollMC._x = -50;
&#125; else if &#40;_root.scrollMC._x>=500&#41; &#123;
_root.scrollMC._x = 500;
&#125;
&#125;


You could either use a mask to only show the selections you want or you can size the clip larger than the stage and use the stage as a sort of mask. One thing to notice is the last set of if statements set the bounds for the scroll. They currently just stop the scroll at the end of the clip. You could have it so that when the clip reaches one side, it loops to the other side to simulate a seemless scroller. Something like this.....

//set the bounds
if (_root.scrollMC._x<=-50) {
_root.scrollMC._x = 450;
} else if (_root.scrollMC._x>=500) {
_root.scrollMC._x = -45;
}


You will have to play around with the numbers to match your own movieclip.

Hope it helps
NTD

Voodoo
08-27-2004, 10:55 AM
thnx i shall try it out and i let you know if it worked
thnx mate