# Changing var value problem

**URL:** <https://forum.kirupa.com/t/changing-var-value-problem/23276>\
**Category:** flash\
**Created:** [June 15, 2003, 6:43pm UTC](https://forum.kirupa.com/t/changing-var-value-problem/23276 "2003-06-15T18:43:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mooler](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mooler](https://forum.kirupa.com/u/mooler)\
**Post date:** [June 15, 2003, 6:43pm UTC](https://forum.kirupa.com/t/changing-var-value-problem/23276/1 "2003-06-15T18:43:52Z")

</div>

I can´t belive it my third post en the same day (must be somekind of record).  
My problem this time is the change of a variables value. Changing the value with an on (Press) in a button like this in the contact button.

[AS]  
on (press) {  
loadswf == contact;  
gotoAndPlay(2);

}  
[/AS]

in the second frame I have the following code

[AS]

if (loadswf == forum) {  
loadMovie(“forum.swf”, “holder”);  
}  
if (loadswf == first) {  
loadMovie(“first.swf”, “holder”);  
}  
if (loadswf == contact) {  
loadMovie(“contact.swf”, “holder”);  
}  
[/AS]

The problem is that it doesn´t work the way I´d like it only loads the last statement (in this case the contact.swf ) and I can´t find the problem so i turn to the almighty kirupa once again.

Attching the fla

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 15, 2003, 7:21pm UTC](https://forum.kirupa.com/t/changing-var-value-problem/23276/2 "2003-06-15T19:21:44Z")

</div>

Ok, well I didn’t check out your .fla, but I can point out what I think may be the problem right now…

[AS]if (loadswf == forum) {  
loadMovie(“forum.swf”, “holder”);  
}  
if (loadswf == first) {  
loadMovie(“first.swf”, “holder”);  
}  
if (loadswf == contact) {  
loadMovie(“contact.swf”, “holder”);  
}[/AS]

It is assuming forum, first, and contact are variables not words. To identify them as strings you need to put them in double quotes… also an if/else string would be better in this situation…[AS]if (loadswf == “forum”) {  
loadMovie(“forum.swf”, “holder”);  
} else if (loadswf == “first”) {  
loadMovie(“first.swf”, “holder”);  
} else if (loadswf == “contact”) {  
loadMovie(“contact.swf”, “holder”);  
}[/AS]

The same double quotes thing goes with assigning the value to the variable, you must use loadswf = “name”, the double quotes are important in this case.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 15, 2003, 7:26pm UTC](https://forum.kirupa.com/t/changing-var-value-problem/23276/3 "2003-06-15T19:26:54Z")

</div>

THX lost I am still pretty new and have this annoying tendency to forget the “small” things. Of course string = “”. \*\*\*\* wish I could us some extra RAM on my brain to speed this learning process.

THX again 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [June 15, 2003, 7:29pm UTC](https://forum.kirupa.com/t/changing-var-value-problem/23276/4 "2003-06-15T19:29:19Z")

</div>

LOL, if only they sold RAM for brains, that would rock.
