# Simple Variable question - Literal Value for Expression

**URL:** <https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999>\
**Category:** flash\
**Created:** [February 4, 2004, 1:43am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999 "2004-02-04T01:43:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![optimis](https://avatars.discourse-cdn.com/v4/letter/o/ac91a4/32.png) [@optimis](https://forum.kirupa.com/u/optimis)\
**Post date:** [February 4, 2004, 1:43am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/1 "2004-02-04T01:43:54Z")

</div>

I know this is basic guys, but please help -

First a fabric button sets:  
\_root.fabricbuttonselected="\_root.fabric01";

then the color button sets:  
\_root.selectedcolor=\_root.fabricbuttonselected + “\_chip10\_name”;

This returns the name of a variable:  
“\_root.fabric01\_chip10\_name”

however I have preset the variable to “Rose”

\_root.fabric01\_chip10\_name = “Rose”;

My dynamic text box is set to:  
\_root.selectedcolor

but instead of displaying “Rose” it displays"\_root.fabric01\_chip10\_name"

Basically I need to get the literal value to equal an expression- how do I do this???

I’ve done this before, but it’s slipping my mind.

Thanks

-DWC

---

<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:** [February 4, 2004, 3:06am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/2 "2004-02-04T03:06:56Z")

</div>

Hi

I think you don’t want to have quotes.  
\_root.selectedcolor=\_root.fabricbuttonselected+ \_chip10\_name;

i might be wrong.

---

<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:** [February 4, 2004, 6:21am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/3 "2004-02-04T06:21:03Z")

</div>

thanks,

But I think that without quotes it will look for the value of \_clip10\_name which there is none because it’s not a variable—

I’ll try it tomorrow and see -

-dwc

---

<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:** [February 4, 2004, 7:45am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/4 "2004-02-04T07:45:15Z")

</div>

Uhmm… have you tried using the [font=courier new]eval()[/font] function?

```auto
_root.selectedcolor = eval(_root.fabricbuttonselected+"_chip10_name");

```

---

<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:** [February 4, 2004, 8:05am UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/5 "2004-02-04T08:05:14Z")

</div>

this sounds like a solution - I’ll try tomorrow AM!!

---

<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:** [February 4, 2004, 7:01pm UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/6 "2004-02-04T19:01:31Z")

</div>

Hi guys, thanks for the help - but I’m still having trouble-

on (release) {

//determine which color has been selected by adding the selected fabric button to the color

\_root.selectedcolor = \_root.fabricbuttonselected+"\_chip06\_name";

\_root.selectedcolor = eval (\_root.fabricbuttonselected+"\_chip06\_name");  
}

//OK This should return the value of the variable \_root.fabric06\_chip06\_name

Earlier in the movie I set:  
\_root.fabric06\_chip06\_name = “mint”;

so I want the textbox with the vaiable \_root.selectedcolor to display: Mint

not working -

any ideas???

---

<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:** [February 4, 2004, 10:42pm UTC](https://forum.kirupa.com/t/simple-variable-question-literal-value-for-expression/41999/7 "2004-02-04T22:42:15Z")

</div>

Well, the code seems to be fine to me. Could you attach your FLA? :-/

…And please use the ActionScript tag [**AS][**/AS] when posting your code. 🙂
