PDA

View Full Version : button repeats rollover's movie clip AFTER on(release)


snocone986
02-17-2005, 06:54 PM
I've created a button in flash MX that includes a movie clip in the "over" position. I'm using this actionscript:

on (press) {
Stop
}
on (release) {
Stop
getURL ("http://www.google.ca");
}

The problem is that once you click the button, in the second before the link is followed (while the new page is loading), the movie clip begins to play again (because the mouse is still over the button). What I want is for it to do nothing at all after on(release). I thought the "Stop" might work, but alas no.

Does anyone know of a way to prevent the over state from activating after the on(release) has had a chance to do it's thing?

Any help is much appreciated!

Byronc
02-19-2005, 03:16 AM
Your syntax is incorrect:

on (press) {
stop();
}
on (release) {
stop();
getURL ("http://www.google.ca");
}
Though you should really only need the stop in the on(press) event.

snocone986
02-19-2005, 02:30 PM
Thank you Byronc for clearing that up. I'm happy to have correct syntax now!
Unfortunately it doesn't seem to affect the problem I was having, and after on(release), my movie clip still starts to play again as the new page loads.
Any other ideas?

Barn
02-19-2005, 06:12 PM
That particular button syntax will only stop the playback of the timeline on which the button is sitting. It will not stop other movieclips from playing, and it has no way to *keep* the timeline stopped, should some other scripting occur that commands the timeline to play.

Doing a getURL(), such as you have done, without specifying another target HTML window, should simply replace your movie with the called page.

The only thing I can presume is that there's something you're leaving out of your description here (such as the on(rollOver) and on(rollOut) code).

snocone986
02-21-2005, 10:14 PM
I think the problem is that the specific content of my button (it's a door that opens when you roll over it) makes a very natural behaviour (returning to the "OVER" state after a click as the next page loads) seem strange, because the door starts to open again while the next page is loading. I guess there's nothing to be done because it will always return to that OVER state if the mouse is still over the button (which invariably it is).

I'll bear this in mind the next time I make a rollover with a movieclip in the over state!

Thanks for all your input Byron!

Barn
02-22-2005, 04:36 AM
Another thing you could do is have the button embedded in a movieclip, or, for that matter, substitute a movieclip, which provides a lot greater range of control. When the button events are applied with functions (i.e., btnName.onPress = function() as opposed to on(press)), they can be deleted in the process of executing other events, that is, you could have the onRelease event delete the onRollOver event.

snocone986
02-22-2005, 03:27 PM
Byron, this sounds like a really promising avenue! Sadly, I think it's outside of the realm of my ability as a new actionscripter. Can you perhaps recommend any online resources (or threads in this forum) where I can learn more about how to do this sort of thing? You are openning up a brand new world of possibility for me!

Sara

Barn
02-23-2005, 01:01 AM
There really a lot of possible avenues, where interactivity is concerned.

I can point you to my example site, where I have numerous examples deploying various button strategies: http://www.canfieldstudios.com/flashmx