I would like to know if there is a way to insert a variable inside “”.
Here is an example to explain what I mean:
First there is a variable:
var myVariable = [Paris, Tokyo, London]
I want this code as it is. I don`t want too change the value to [“Paris”, “Tokyo”, “London”].
Now I want to use this variable to make a button tell the main timeline to go to the frame “Paris”.
In other words the equivalent of
startButton.onRelease = function() {
this._parent.gotoAndStop("Paris");
};
But using a variable I only know how to do this:
startButton.onRelease = function() {
this._parent.gotoAndStop(myVariable[0]);
};
//this equals gotoAndStop(Paris)
startButton.onRelease = function() {
this._parent.gotoAndStop("myVariable[0]");
};
//this equals gotoAndStop("myVariable[0]")
Is there a way to put the value of the variable between “” so that it equals gotoAndStop(“Paris”), without changing the variable code itself?