PDA

View Full Version : repeating the mouse down in flash



Jnaae
February 1st, 2002, 08:02 AM
How can I create a button that will repeat an action for as long as the mouse button is down on the button?

Phil Jayhan
February 1st, 2002, 08:31 AM
Create a movie clip inside the button. Use these commands or something similar; On mouse event/Press/Load Movie (Inside this movie create the actions you are desiring). This should solve your problem.

pj

Jnaae
February 1st, 2002, 09:16 AM
I don't know if you completly understand me....What I need is a code that will repeat an action when the button is clicked or actually rolled over.

msjensen
February 1st, 2002, 10:29 AM
if the action that you want is just an animation then it then all you have to do is nothing. The movie clip will repeat as long as the mouse is over the button. It is harder to do when you want it on a click since people usually don't hold down their button very long.

Maybe if you tell us what actions you want repeated, it will help answer your question.

Matt

Jnaae
February 1st, 2002, 11:19 AM
Here is the code I am attempting to use....

on (press, keyPress "<Left>") {
&nbsp &nbsp &nbsp &nbsp tellTarget ("webimaging") {
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp gotoAndStop (_currentframe-1);
&nbsp &nbsp &nbsp &nbsp }
}

eyezberg
February 1st, 2002, 11:23 AM
I believe "press" is only accounted for once, so the action related to the event happens only once too..
Maybe use a variable you use as a switch: on press, var=1, and while var=1, do this (whatever);
on release, var=0, and so, the condition checked with vars value not being true anymore, the action should stop..?
Haven't tried..

ilyaslamasse
February 1st, 2002, 12:42 PM
Totally agree With the Eyez. Use flags.
pom 0]

suprabeener
February 1st, 2002, 02:53 PM
the "button in a movie" technique will do the trick.

make a button:


on(press){

mpress = 1;

}



on(release,releaseOutside){

mpress=0;

}

make that button a movie, and in the movie:


onClipEvent(enterFrame){

if(mpress){

_root.webimaging.prevFrame();

}

}