Groups | Blog | Home
all groups > flash actionscript > april 2007 >

flash actionscript : Variable comparison problem



dan mode ->Adobe Community Expert
4/10/2007 5:02:46 PM
Have a look at this http://www.smithmediafusion.com/blog/?p=235
It has some logic that might help.


--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com <--check this

*Must Read* http://www.smithmediafusion.com/blog


[quoted text, click to view]

symmetricalMan
4/10/2007 10:54:28 PM
Actionscript newbie.

I have three variables that I call as follows:
_global johnAlt = false;
_global garyAlt = false;
_global tonyAlt = false;

I also have three buttons, each of which changes the value of each variable,
like:
on (release) {tonyAlt = true;}

Later, I need to compare the three values, so I've written code like this:
if ((johnAlt = true) && (garyAlt = true) && (tonyAlt = true))
{gotoAndPlay(3);}

else {stop();}

It doesn't work.
I've tried using all sorts of combinations of code, including using double ==.

The only way I got it to work was this way:
if ((johnAlt = garyAlt) && (garyAlt = tonyAlt) && (tonyAlt = johnAlt))

...which essentially is what I'm asking all along, because I'm testing to see
when they're all 'true'. But, what if I was trying to compare specific values,
like
if ((car=red) && (gofaster=stripes) && (bigbutton=off))?

I've checked the Flash help, and various forums, and from what I can see, my
code is suppsoed to work.

Any ideas?

AddThis Social Bookmark Button