Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gotoAndPlay won't "play"!

0 views
Skip to first unread message

mike sieron

unread,
Oct 5, 2001, 12:55:31 AM10/5/01
to
I'm going nuts over something that's Flash 101.
I have a (F5) movie with 4 layers, and it's 30 frames long.

There are stop actions in frames 10, 20, and 30.
There are labels in frames 10("one"), 20("two"), and 30("three").
Theres a button on the main timeline that, onrelease, creates a variable
named "a"using the math.random function to create a random number
between1 and 3. the code:

on (release) {
a = Math.floor(Math.random()*3)+1;
}


I have an output textbox to see the variable "a".

theres also a button on the timeline that has the following code:

on (release) {
if (a==1) {
gotoAndPlay ("one");
} else if (a==2) {
gotoAndPlay ("two");
} else if (a==3) {
gotoAndPlay ("three");
} else {
stop ();
}
}

This is what happens. When a=1, the play head goes to "one" and stops.
When a=3, it goes to "three' and stops. But, when a=2, the playhead goes
stays at "one" AND "a" changed to 1.

What am I missing here?

thanks!

Tim Simmons

unread,
Oct 5, 2001, 3:31:42 AM10/5/01
to

"mike sieron" <m...@sieron.com> wrote in message
news:3BBD3D43...@sieron.com...


Tim S.:

Lose the else. Won't fix your problem but it's never going to get executed
(unless you later add other #s than 1-3).

Seems like it should work but have you made sure that frame "two" is
actually spelled "two"?

Can't say more w/o seeing the fla.


Thanks,
Tim


Byron Canfield

unread,
Oct 5, 2001, 1:30:05 AM10/5/01
to
Let's try it a different way. Instead of the frame labels "one", "two", and
"three", use the label names "section1", "section2", and "section3", and
also have a frame with the label "section0" after which you have a frame
with just a stop action, which is where the "playhead" will go if the number
selection button has not been clicked.

And then instead of a complex conditional, have your button action like
this:

on (release) {
gotoAndPlay ("section" + a);
a = 0;
}


--
Byron "Barn" Canfield
Canfield Studios: http://www.byronc.com

"mike sieron" <m...@sieron.com> wrote in message
news:3BBD3D43...@sieron.com...

mike sieron

unread,
Oct 5, 2001, 11:06:54 AM10/5/01
to
Yes. Everything is spelled right. All works fine except for frame "two".
It's weird: If I change the label name from "two", to the numeral 2, it works.

ROnslow not anonymous anymore

unread,
Oct 5, 2001, 12:37:14 PM10/5/01
to
I bet you've used a=1 instead of a==1.

That could explain the problem.

Check all you = and == and ensure you use double== when you should and vice
versa !!

--

"mike sieron" <m...@sieron.com> wrote in message
news:3BBD3D43...@sieron.com...

mike sieron

unread,
Oct 5, 2001, 2:35:33 PM10/5/01
to
Everything re: "==" is correct. I give up. Maybe my Flash application is
corrupted in some way. I'm going to reinstall it. That's helped with
other problems I've had. BTW: I'm on a Mac, so I don't know if F5 is
'buggy' with this Os, than say, Windows. I LOVE F4, but I just can't get
used to F5. It just acts weird!

Byron Canfield

unread,
Oct 5, 2001, 3:57:25 PM10/5/01
to
Did you copy and paste the code into your posts or did you retype it? If the
latter, do the former.

--
Byron Canfield
Canfield Studios
http://www.byronc.com
----- I do not respond to private emails, nor do I reply to posts by
email. -----

mike sieron <m...@sieron.com> wrote in message

news:3BBDCC8E...@sieron.com...

mike sieron

unread,
Oct 5, 2001, 11:34:35 PM10/5/01
to
I copied and pasted it.
0 new messages