Welcome to WebmasterWorld Guest from 23.23.57.144

Forum Moderators: open

Could someone error check this?

Just a pair of ifs

   
10:56 am on Feb 18, 2009 (gmt 0)

5+ Year Member



As far as I can tell this is valid as2 code:

if (no.frame = 1) {
no.onPress = function(){
play();
no.gotoAndStop(2);
}}

if(no.frame = 2) {
no.onPress = function(){
stop();
no.gotoAndStop(1);
}}

But it doesn't quite work as expected when I preview it.
The button this is attached to fails to gotoAndStop at frame 2 of the mc and invokes the stop(); function when no.frame is one.

I suspect this needs to handled with an else if statement, but my attempts so far to create one produce 2 or 3 errors in the output dialog.

12:16 pm on Feb 18, 2009 (gmt 0)

5+ Year Member



Significant progress!

no.onPress = function(){
if (no.frame = 1) {
play();
no.gotoAndStop(2);
}

else {
if(no.frame = 2) {
no.gotoAndStop(1);
stop();
}
}}

The top statement is fully operational, including sending the no movieclip to frame 2 - but the bottom statement is being ignored.

There are no error messages.

I think it could be using an if in an else statement. I'm not certain this is allowable.

UPDATE: This is ignoring the conditions.

[edited by: GGR_Web at 12:58 pm (utc) on Feb. 18, 2009]

2:01 pm on Feb 18, 2009 (gmt 0)

5+ Year Member



Fixed it.
3:21 pm on Feb 18, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Sorry GGR! Sometimes you just need to see it typed out in a forum to find the solution . . . so . . . what was it?

There are no error messages.

Publish settings?

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month