Flash Button Help
- Started
- Last post
- 4 Responses
- patnoodle
Trying to set up a nav system but having problems coding the down-state. I'm using a movieclip (button_mc) which advances the animation when the button (b1) is rolled over and reverses when it is rolled out. When the button (b1) is pressed I want the movieclip (button_mc) to stop on the last frame (5) and for the rollover actions to stop working so it just sits as static text.
Can anyone help? I think I need to clear the rollover/rollout actions but I'm not sure of the best way to go about it.
___________________
// frame actions
button_mc.onEnterFrame = function() {
if (b1over) {
button_mc.nextFrame();
} else if (!b1over) {
button_mc.prevFrame();
} else if (b1down) {
button_mc.gotoAndStop(5);
}
};______________________
// button actions
on (rollOver) {
b1over = true;
}on (rollOut, dragOut) {
b1over = false;
}on (release, releaseOutside) {
b1down = true;
}
- patnoodle0
Work in progress:
http://www.stimuli.co.uk/theflas…
- Neuarmy0
b1.onPress = function {
button_mc.gotoAndStop(5);
}
- patnoodle0
But that would mean the actions for rollOver/rollOut are still active and when I roll out of the button it would start to animate back again.
I need to somehow clear the actions associated with the rollOver/rollOut but I'm not sure where to start.
- patnoodle0
Got it working, thanks anyway.
Here's what I was trying to achieve:
http://www.stimuli.co.uk/Now I'll need to streamline it, this code repeated for each and every button isn't really efficient. Any tips/suggestions?
__________________
// frame actions
var btnDown;
b1.onRollOver = function() {
if (btnDown == undefined || false) {
clearInterval(playI);
playI = setInterval(playF, 30, button_mc, 1);
} else {
continue;
}
};b1.onRollOut = b1.onDragOut = function () {
if (btnDown == undefined || false) {
clearInterval(playI);
playI = setInterval(playF, 30, button_mc, 0);
} else {
continue;
}
};b1.onPress = function() {
clearInterval(playI);
button_mc.gotoAndStop(5);
btnDown = true;
};function playF(mc, arg) {
trace(arg);
if (arg) {
mc.nextFrame();
} else {
mc.prevFrame();
}
}