Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Problem with an if statement.

I am having a problem with a variable in an if statement.

12:10 am on May 17, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:June 16, 2007
posts: 120
votes: 0

I am currently trying to make a game that involves many spaces for the pieces to go on. I keep track of what piece is on each square with the use of many variables. So, for example, the first square has an attached variable called "s1", the second square has an attached variable called "s2", and so on. I tried to run the following code, to make the pieces move-

var op = 6; //This is just an example, this would actually be based on the piece that is clicked on.

if(_root.s&var(op)=='0'){ //if nothing is on it

I continuously get error messages involving the if statement. I want it to turn into, " if(_root.s6=='0'){".

Do you know how to fix this?

Please help!