Keep on scrollin'

I want to know how to keep scrolling a movieclip when you press a button.
Now, you have to click and click and click, instead of just holding down your mousebutton.

This is my script:
on (press) {
setProperty("_root.main.Scroll.Inhoud", _y, getProperty("_root.main.Scroll.Inhoud", _y)+10);
}

I can’t get a loop above the “on(press)…”
How can I loop this peace of script?

Or is there a more effective script?

THanx!

hey hihabyte =)

if you are using mx … i think the easier way would be dynamic event handlers :slight_smile:

myButton.onPress = function() {
	_root.main.Scroll.Inhoud.onEnterFrame = function() {
		_y += 10;
	}
}
myButton.onRelease = myButton.onReleaseOutside = function() {
	delete _root.main.Scroll.Inhoud.onEnterFrame;
}

by the way, welcome to kiruaville! :wink:

[size=1]ps. please read before posting[/size]

And to what should I assign this script?
Because, if I assign it to the button, he always puts “On release” in front of it…
Help me, I’m feeling very stupid now ;(

eager to learn…

Thanx!

Ooooohhw, I forgot to say!

I use flash MX!!!

(aaarrrggghhhhh :slight_smile: )

oh! sorry … i’m really used now to put all my scripts in the timeline :slight_smile:

the script i posted should be in the timeline, being myButton the instance name of your button :wink:

YeS!!! It works, at last!! Thank you very much for helping me with this peace of script, Kax!!

But I said I was eager to learn…so I would also like to understand this script completely.
I think I do, except for the OnEnterFrame part.
What does it do exactly? I don’t really understand the explanation in the Flash reference… so could you try to explain?

Thanx!! (again =) )

no problem :wink: =)

and well, the onEnterFrame handler basically executes the statement(s) at the frame rate of the movie.

so if the fps of your movie is at 24, the statements within the onEnterFrame handler would be executed 24 times per second.

:stuck_out_tongue: =)

That’s just what I needed. Now I understand it completely!

thanx!

:stuck_out_tongue:

you’re welcome =)