Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

difference between"=" and "==" ???

Status
Not open for further replies.

Jennyucf

Instructor
Jun 22, 2001
215
US
Hi, I am confused about "=" and "==". Any difference?
 
I think it's a actionscript version syntax type thing...

I'm pretty sure Flash 4's actionscript has to have == to mean equals, and Flash 5's actionscript uses = only. ----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
OK. But when I deconstruct a script, and found the following code:
on (release) {
if (this.pressed==0) {
tellTarget ("cross") {
gotoAndStop ("pressedup");
this.pressed = 1;
}

Are they really the same??

Thanks!!
 
Jenny...
You would assign a value to a variable with "=" only as /:variable = 1;, or /:variable = "Jenny";, but in an if statement, you would use "==":
if (/:variable == 1) { do something... } or this if (/:variable <= 1) { do something... } meaning if the variable is equal or smaller than 1, do something...

;-)ldnewbie
 
Hey old...I've used just 1 ='s when I've done an if statement...how'd I do that I'm wondering...lol

Dazed and confused,
Anthony ----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
I got it!! Thank you ldnewebie. This is something that I probably could never find in a tutorial..:)
 
Well you can write it that way... But it won't work!
To test this try a trace statement after your if statement, you'll see what I mean.

/:variable = 1;
if (/:variable == 1) {
trace (&quot; Variable equals 1&quot;);
}
The above will open the output window and print &quot;Variable equals 1&quot;. If you remove one of the &quot;=&quot; in the if statement, it won't!

;-)ldnewbie
 
Cool...I gotta go back and look at the code...weird. ----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
My last post is an answer to Luke!
And Jenny, my handle is oldnewbie not ldnewbie. The ;-) replaces the &quot;o&quot;!

LOLldnewbie
 
To put it simply,

1=&quot;2&quot; means the value of variable 1 is 2.
1==2 means the value of variable 1 must be the same as variable 2. Live forever or die trying.
 
ok, so basically one is set, the other is check...right?
Set variable = bla (just sets the variable)
Check variable == bla (if it's bla, it returns true)
Regards,
AnthLOLny
----------------------------------------
The Learning process is just a way to get rid of all the stupids in your head.

Now where's that cute little kitten? :-X
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top