Continuous press button?

I’ve got problem to assign my button to do action while still pressing… please help me with the action script…

I could do this with 4 button & 2 layers with cross key frames with track as menu item & basic actions…

Is there any simple ways???

I’m sorry. I don’t understand your question.

Do you mean that you want something to continue happening as long as a the mouse button is held down on a button - and then stop when it is released?

yes…yes…kenny… could you help me with that??? thank u…

While I’m not sure what you want to happen while the mouse button is pressed, I will guess that you want a looping animation to play. I will further assume that you have this animation in a movieclip, which I will call mc01, and that it is on the _root stage.

on(press) {
_global.goAhead=1
_root.mc01.Play()
}
on(release) {
_global.goAhead=0
_root.mc01.stop()
}

//
Then, on frame 1 of mc01:

if (goAhead!=1) {
stop()
}

//

Then, add this to the code for mc01:
onClipEvent(load) {
_global.goAhead=0
}

How could u be still a Junior Member??? U Should be a Senior I think…:slight_smile: Thank’s A Lot Man!!

But I Still have 2 question to ask, if u be so kind tell me how…

HOW to determine the last keyframe on mc01 animation as the maximum pressed action on the button and not loopin’ again to frame 1 of the mc01 animation…

HOW about another button for do previous frame of mc01 animation and make the 1st key frame is the max pressed for this button…

Thank’s again Kenny…(Senior Member of Kirupa.com) :slight_smile:

I’m sorry, but I must clarify your questions. I do not understand what you mean by “max pressed.” Please tell me if I understand your two questions.

Are you asking?

  1. How to keep the animation in mc01 from looping back to the beginning?
    If so, place a stop() on the last keyframe.

  2. Are you asking how to reverse the animation of mc01 when a second button is pressed?
    If so, you must have something on stage that is constantly looping, like an empty movieclip. I’m assuming that all of the code I suggest previously is still in place. Then, on the new second button:

on(press) {
_global.reverseMc01=1;
_global.goAhead=1;
}

on(release) {
_global.goAhead=0;
_global.reverseMc01=0;
_root.mc01.stop()
}

//Then, on the empty mc on stage:

onClipEvent(enterFrame) {
if (reverseMc01==1) {
_root.mc01.prevFrame();
}
}

//Then, on the first frame of mc01:

if (goAhead!=1) {
stop()
}
if (reverseMc01==1) {this.gotoAndStop(25);} // Replace “25” with the last frame of mc01 - or with its label.

What I’ve basically described is how to forward and reverse and animation while pressing a button. I have a simple fla with the code that you can download:

http://aspirin99.guardianhosting.net/misc

what i mean with maxpress is the button will not loopin again to the first key frame of the mc animation, it stop completely on the last key frame ( sorry if the question confusing).

i’ve seen the sample fla, thank’s … but it’s loopin.

I’ll send to your email the sample fla i’ve made for u to examine… if u don’t mind… I just want the simple way to do this…