OK, try this simple test with me.
In Flash CS3, make a new AS 2 movie.
Create three named frames, ten frames apart - call them "s1" "s2" and "s3". Do
not use Scenes.
Make an actionscript layer. On the first frame of each of these named
sections, put a "stop();" in the actionscript layer.
Create a button on the stage. Let's call it "btn1" -- you can name it's
instance "btn1", too, if you like, we don't care.
Convert the button to a movie clip. Call it "mc btn" or whatever. So now we
have a button wrapped in a movie clip.
Make two copies of the movie clip, so now we have three movie clip/buttons
instances on stage. Name the movie clip instances "b1" "b2" and "b3"
Extend the span of these movie clip buttons across all three named markers, so
they're on stage the whole time. No keyframes necessary, just insert frames
(F5) for their layer around frame 30 or so.
Put something else innocuous on stage for each of the sections, so that you
can distinguish between the named frames, so you know you arrived there, e.g.,
a static text label that says "s1" "s2" or "s3"...
Add this script into the actionscript layer on frame 1, after the stop();
this.b1.onMouseUp = function () {
_root.gotoAndStop("s2");
}
this.b2.onMouseUp = function () {
_root.gotoAndStop("s3");
}
this.b3.onMouseUp = function () {
_root.gotoAndStop("s1");
}
So, button 1 is supposed to take us to s2, button 2 will take us to s3 and
button 3 will return us to s1.
Test the movie.
Click on any of the three buttons. It will take you to "s2"
In s2, click on any button. It takes you nowhere.
Even if you copy/paste the button scripts into the first frame of the s2 and
s3 actionscript layer, there is no difference. All buttons take you to s2.
Furthermore, if I click ANYWHERE on the stage, not even on a button, it still
takes me to "s2"
What kind of madness is this?
I know there must be a simple answer, but this is completely counter-intuitive.
kgille22 - 30 Nov 2008 19:58 GMT
This as2 script does what I think you are looking for:
stop();
b1.onRelease = function() {
_root.gotoAndStop("s2");
}
b2.onRelease = function() {
_root.gotoAndStop("s3");
}
b3.onRelease = function() {
_root.gotoAndStop("s1");
}
NedWebs - 30 Nov 2008 20:09 GMT
onMouseUp is a mouse event, not a movie-mouse interaction event. So what will
happen is that all three of those mouseUp events will be executed.
kgille's solution is the correct implementation. Also, just curoius why you
want to have a button in an mc if the mc is being used as a button?
Walter Elias - 01 Dec 2008 01:01 GMT
Also, If the ActionScript is in frame 1, but the movie clip/buttons don't
appear until frame 30, likely they won't work. I'm not sure whether
theoretically it should work anyway, but in actual practice you need to put the
script on the same frame (or later) than the initial instances of the movie
clips.
And I'm also confused why you'd bother wrapping buttons in movie clips. That's
kind of redundant. You can use the same buttons 3 times, with different
instance names.
B.Russell - 01 Dec 2008 04:59 GMT
Thanks, all.
Just to clear up a couple of points -- the buttons run the whole span from
frame 1 to frame 30. That's what I was trying to say about insert frames.
One question -->
>>onMouseUp is a mouse event, not a movie-mouse interaction<<<
So, it's a different command than onClipEvent (mouseUp)? Man, that is GENIUS!
That's almost as brilliant as having the same hot keys mean different things
depending on which window is in the forefront! (snark snark)
Also, as to why a button inside a movie clip...
The system I'm building is going to run on a touch screen monitor, off a
proprietary digital signage box running a version of XP embedded (i.e., not a
real computer) and ELO touch screen drivers. They claim to "support Flash" and
it's my job to make it work.
There's just a few problems!
The only two button-related commands the system recognizes are roll over and
mouse up.
It does not understand nor respond to Press, Release, Roll Out, Mouse Down,
etc. So I need my only two available commands available to me in any button
I'm going to use.
Definitely a PITA!
I probably could have figured this out, but I appreciate the help after a long
and frustrating few days.
Rothrock - 01 Dec 2008 05:31 GMT
No onClipEvent(mouseUp) is the same as onMouseUp. You just didn't understand it then either! :)
onClipEvent(press, release) are the same as onPress or onRelease.
B.Russell - 01 Dec 2008 14:13 GMT
I was being facetious -- that's what "snark" means.