PDA

View Full Version : scroll button problem...


zerosk8
04-10-2006, 05:30 PM
Hi everybody!

I have a movieclip called sq4 that contains a long list of items.

I have applied a mask to this movieclip, so that only a part of it is visible .

I have created a button called downbtn: when you press it, it make the movieclip go up 33pixels, so that for every click the movieclip scroll down:

downbtn.onPress = function() {
sq4._y=sq4._y-33;
}

the problem is that the list is very long and if you want to reach the end of the list it takes too much time (and clicks).

I thought that it would be nice that if you press (and keep pressed) on that button the list goes down let's say 33x6=198 pixels every second you keep pressed. Just like windows scrollbars arrows, you know.....

How can i do that?

Thank you for reading. Sorry for my BAD english!! :o

mcmcom
04-10-2006, 08:33 PM
why dont you put the movie clip in a scrollpane, thats what it is designed for.

zerosk8
04-11-2006, 01:11 PM
why dont you put the movie clip in a scrollpane, thats what it is designed for.

Actually the structure is more complex thanI've described. Inside the movieclip are nested other clips based on an external xml. Maybe you find this so easy, but I don't, it's already a victory that i could manage to make the whole thing work , so I'd prefer not to modify it and concentrate my efforts on the buttons.... :D

Anyway thank you for your advice, I appreciate ! ;)

arkanoid2k
04-11-2006, 01:29 PM
one way of doing so it would be to use a Do-While or the "onEnterFrame() = function" + an IF.

mcmcom
04-11-2006, 04:11 PM
doing it the way you suggest is way more complicated than using a scrollpane. You can slightly modify your code to include all the clips into one movie clip and attach that to a scrollpane with very little code

ie:

//attach holder Clip to scrollpane
myScrollPane.attachMovie("myHolderClip");
//attach button movies to holder clip
myScrollPane.myholderClip.AttachMovie("button1")
//set x & y and add another


and just add all the buttons to myHolderClip after it.

im just saying that creating a scrolling function is very tricky to do, especially handling the math. Just my free advice.

mcm

arkanoid2k
04-12-2006, 12:55 AM
components for sure are, in some cases a good option. in some others is better to have a custom AS doing just what u want, with no extra weight.

zerosk8
04-23-2006, 10:49 AM
ok guys, thank you very much! I'll try with the scroll pane!

...And hope it won't become a ...scroll pain ! :rolleyes:



Thank you for your advices! :D

pitu
04-23-2006, 01:50 PM
The code of mcmcom
does not work for me.... that is:

//attach holder Clip to scrollpane
myScrollPane.attachMovie("myHolderClip");
//attach button movies to holder clip
myScrollPane.myholderClip.AttachMovie("button1")
//set x & y and add another

the only way I can 'attach' something to ScrollPane is

scrollPane.contentpath="somemovie"

where somemovie can be a file to load or a linikage name in the library....

this causes some problems to me beacuse in both cases the height of the movie to be put in ScrollPane has to be pre-determined...

So ..if someone has any idea how to put an already existant movieholder
on the stage, to the scrollPane that would help me a lot...

myScrollPane.attachMovie("myHolderClip");
just does not work for me...