ActionscripNoob
ActionscripNoob

Reputation: 1

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

Upvotes: 0

Views: 287

Answers (2)

Jared
Jared

Reputation: 4983

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.)

Upvotes: 1

ocodo
ocodo

Reputation: 30248

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.

Upvotes: 0

Related Questions