开发者

Actionscript Boolean

http://pastebin.com/JaqiheV2

is the code. I'm trying to change the boolean value of bottomLeft to false or true in the appropriate if sections, but I'm not sure how to开发者_运维百科 properly format it to actually work


To set something equal to something else...

x = 4;

...use one equal sign.

To check if something is equal to another...

x == 4

...use two!

Also, the easiest way to check a boolean with an if statement is simply to type the boolean as the parameter.

if(baconIsCooking){
then...
}

In the above code, if baconIsCooking is "true", it will run. Similarly, you have a shorthand way of checking to see if something is false as well.

if(!suzieThinksImCute){
then...
}

By placing an exclamation point before a boolean, you're telling the statement to check if it's false.

Also note how I named them in an easily readible manner, when you're working with hundreds of lines of code and countless variables floating around, it makes it much easier to make sense of a piece of code you haven't seen in a week.

(Suzie was ugly anyway.)


if (bottomLeft = (false)) {

This line has a syntax error, it should be:

if (bottomLeft == false) {

Or better yet:

if(!bottomLeft) {

Which means if bottomLeft is NOT (!) true, or read literally ... if NOT bottomLeft

When you name things, make sure that this sort of statement would make sense, as it stands, it's difficult to determine what you are actually doing with bottomLeft and what it represents, so suggesting a meaningful name is difficult.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜