Simple Variable question - Literal Value for Expression

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

Hi

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

i might be wrong.

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

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

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

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

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???

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. :slight_smile: