homepage Welcome to WebmasterWorld Guest from 54.226.21.57
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

    
if (false) {} causes strange behavior in AS3
it makes the publishing go wrong without notice
gergoe

10+ Year Member



 
Msg#: 3711997 posted 12:56 pm on Jul 31, 2008 (gmt 0)

If you ever happen to use the following (at least it was the case with me, using Flash CS3 with ActionScript 3):
if (false) {
// Old code
} else {
// New (candidate) code
}

...then don't be surprised if the published movie does not work anymore. Modifying the code to:
if (!true) {
// Old code
} else {
// New (candidate) code
}

...solves the problem. Weird enough.

Looks as if the compiler crashes at this point in the movie, it behaves as if it were a compile error - but without any error message.

 

rocknbil

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



 
Msg#: 3711997 posted 4:18 pm on Jul 31, 2008 (gmt 0)

A little more info? True and false are reserved words. Are you saying you are creating variables named true and false, and take actions whether or not they exist?

if (some_event) { var myVar = 1; }

if (myVar) {
// this should work
)

gergoe

10+ Year Member



 
Msg#: 3711997 posted 10:14 pm on Jul 31, 2008 (gmt 0)

No, nothing like that. true is the boolean constant true, and false is its counterpart. Just simply pointed out that for me using

if (false) { somecode } else { someothercode }

...stops the movie being compiled properly. Anything other than that works (1==0, !true or true&&false), but if I just use false as the condition, that doesn't.

Nothing needs to be solved here, just found it interesting enough to post it here, might come handy for someone (or a good start for experimenting or bug reporting :-)

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