To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 02-03-2006, 01:46 PM   #1
impsvi
Member
 
Join Date: Sep 2005
Posts: 37
If Statement code generating errors - help!

I'm having problems getting my if statement to work. I have 4 flowers on screen as buttons, and i want to be able to click on them to 'pick' them (make them disappear). Once all 4 flowers have disappeared/been picked i want to go to a new frame label.

The code i put in to make the flowers invisible once clicked worked. But when i tried to add an if statement to check whether all flowers had disappeared to move on to the next frame label, i kept getting error messages.

This is my code:

var flower1:Boolean = true;
var flower2:Boolean = true;
var flower3:Boolean = true;
var flower4:Boolean = true;

flower1_btn.onRelease = function() {
flower1 = false;
flower1_btn._visible = false;
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){
gotoAndPlay("badgerSmile")
}
};
flower2_btn.onRelease = function() {
flower2 = false;
flower2_btn._visible = false;
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){
gotoAndPlay("badgerSmile")
}
};
flower3_btn.onRelease = function() {
flower3 = false;
flower3_btn._visible = false;
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){
gotoAndPlay("badgerSmile")
}
};
flower4_btn.onRelease = function() {
flower4 = false;
flower4_btn._visible = false;
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){
gotoAndPlay("badgerSmile")
}
};
stop();

The error message I am getting is as follows:

Left side of assignment operator must be variable or property.
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){

It seems that it does not like my if statement condition, even though i thought i had defined the flowers as variables.

If anyone can help me out with this problem, i would be very grateful. I am using Flash8 Pro

Thanks
impsvi is offline   Reply With Quote
Old 02-03-2006, 03:49 PM   #2
gorlummeeguvnor
Senior Member
 
Join Date: Nov 2004
Posts: 873
if (flower1 = false && flower2 = false && flower3 = false && flower4 = false){


if (flower1 == false && flower2 == false && flower3 == false && flower4 == false){

== checks to see if it equals
= sets the value of the variable to it
gorlummeeguvnor is offline   Reply With Quote
Old 02-03-2006, 03:52 PM   #3
a_modified_dog
FK'n_dog
 
a_modified_dog's Avatar
 
Join Date: Apr 2003
Location: "aaarf"
Posts: 9,176
you need == to make comparisons -
if (flower1 == false && flower2 ==......)

as you are checking for Boolean false you can use -
if (!flower1 && !flower2 &&......)
a_modified_dog is offline   Reply With Quote
Old 02-03-2006, 06:03 PM   #4
impsvi
Member
 
Join Date: Sep 2005
Posts: 37
Thanks

Thanks so much - that works a treat!

I'll remember that in future, cheers.
impsvi is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:56 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.