-
Blood elf, or PHP guru... hmmm
on (rollover) {
tar = tar +10;
}
When i use this on a button, is there any way to make it keep repeating? Such as as long as the mouse is over the button, it adds +10 in like second intervals?
Thank You,
-Dox'
-
There may be an easier way to do it, but one way would be to drop the button into a MC. Detect when the mouse is over the mc with something like:
onClipEvent(enterFrame) {
x_pos = _root.myMovieClip._xmouse
y_pos = _root.myMovieClip._ymouse
etc. }
When that condition becomes true, your button variable could begin incrementing and stop when it is no longer true.
-
Another option is to use setInterval.
Assume that you have a mc called myButton (I know - names are not my strong point) that contains a text field called counter, then:
Code:
var IntervalID;
var myCounter = 0;
myButton.onRollOver = function() {
IntervalID = setInterval( incrementMe, 1000 , this);
};
myButton.onRollOut = function() {
clearInterval(IntervalID)
};
function incrementMe(me) {
me.countText.text=(myCounter++);
};
This will bump up the counter every second while the mouse is over the mc.
-
Blood elf, or PHP guru... hmmm
Docka!
Thanks Docker, I was messin with Set Interval earlier.. couldnt get it to work.. I'll try your way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|