homepage Welcome to WebmasterWorld Guest from 54.197.183.230
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
Could someone error check this?
Just a pair of ifs
GGR_Web

5+ Year Member



 
Msg#: 3852231 posted 10:56 am on Feb 18, 2009 (gmt 0)

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.

 

GGR_Web

5+ Year Member



 
Msg#: 3852231 posted 12:16 pm on Feb 18, 2009 (gmt 0)

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]

GGR_Web

5+ Year Member



 
Msg#: 3852231 posted 2:01 pm on Feb 18, 2009 (gmt 0)

Fixed it.

rocknbil

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



 
Msg#: 3852231 posted 3:21 pm on Feb 18, 2009 (gmt 0)

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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved