# Vars/ifstatements

**URL:** <https://forum.kirupa.com/t/vars-ifstatements/28683>\
**Category:** Uncategorized\
**Created:** [August 16, 2003, 9:12pm UTC](https://forum.kirupa.com/t/vars-ifstatements/28683 "2003-08-16T21:12:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yonip](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yonip](https://forum.kirupa.com/u/yonip)\
**Post date:** [August 16, 2003, 9:12pm UTC](https://forum.kirupa.com/t/vars-ifstatements/28683/1 "2003-08-16T21:12:16Z")

</div>

Iam having this problem with some actions:  
what iam trying to do is use a button on the main stage to change a frame of a symbol through some variables

```auto

on (release) {
set("paint",black);
}

```

is the button on the main stage that sets the thing

```auto

onClipEvent(enterFrame) {
if (_root.paint = "black") {
	_root.car.f1.kit.gotoAndStop("black");
	} else {
	_root.car.f1.kit.gotoAndStop("desert"); }

}

```

is the actionscript of ‘f1’ symbol inside the car symbol, kit is inside f1 and iam trying to make it play a frame labeled above, i would just tell it to play a frame, but theres like a thousend other objects in this movie.

thanks

---

<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:** [August 16, 2003, 9:18pm UTC](https://forum.kirupa.com/t/vars-ifstatements/28683/2 "2003-08-16T21:18:04Z")

</div>

Assign the value to the variable as a string.  
[AS]paint = “black”;  
// or  
set(“paint”, “black”);[/AS]  
And you use the equality operator (==**), not the assignment operator (=**).  
[AS]if (\_root.paint == “black”) {[/AS]

---

<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:** [August 16, 2003, 9:21pm UTC](https://forum.kirupa.com/t/vars-ifstatements/28683/3 "2003-08-16T21:21:19Z")

</div>

thanks alot  
now we can jump for joy with 40s in our hands 🙂

---

<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:** [August 16, 2003, 9:22pm UTC](https://forum.kirupa.com/t/vars-ifstatements/28683/4 "2003-08-16T21:22:56Z")

</div>

Hehe - No problem. 😉
