Trying to create dynamic text from a formula
I have a number of dynamic text windows in which I want to display some text that is generated from string variables containing the desired text. I want the text to be displayed when a button is clicked. The following code shows what I am trying to do.
The variables containing text are:
var 101:String = ("TEXT FOR VARIABLE 101");
var 201:String = ("TEXT FOR VARIABLE 201");
var 301:String = ("TEXT FOR VARIABLE 301");
This is the button that makes it happen.
buttonA1_btn.addEventListener(MouseEvent.CLICK,button1_btnClick);
function button1_btnClick(event:MouseEvent):void
{
selectA1_txt.text = (1 + youAreHere_txt.text + ("1"));
selectA2_txt.text = (2 + youAreHere_txt.text + ("1"));
selectA3_txt.text = (3 + youAreHere_txt.text + ("1"));
}
In the above equations the value of youAreHere_txt.text is 0 for the initial case, hence the values of the three statements are 101,201 and 301.
But I don't want to see those values. I want to see the text that those values represent, ie TEXT FOR VARIABLE 101 etc.
Is there a way of doing what I am looking for? Your help would be much appreciated.
