Hello
I have a dynamic textfield, which is supposed to sit inside a button and call a variable from an array, but for some reason, it doesn’t want to work.
I’ve attached it, but I’ll put the code here too, as it’s quite short.
var rockets:Array = new Array();
/*
rockets[] is a multi-dimesional array which holds the built rockets in the player's inventory.
It's elements are
[0] name of the equipment for display purposes
[1] name of the equipment for code purposes
[2] the reliability of the equipment in %
[3] whether or not the equipment is selectable by the player in the current mission plan - set in mission.as (true or false)
[4] whether the player has the item in their inventory, either by building it, or at the start of the game (true or false)
*/
rockets = [
["V2 rocket #1", "V2-1", 67, false, true],
["V2 rocket #2", "V2-2", 54, false, true]
];
Then, on a dynamic text field inside the button I point the Var: window to [COLOR=Blue]_root.rockets[0][2][/COLOR] (I also tried just plain old [COLOR=Blue]rockets[0][2][/COLOR], but that didn’t work either). Basically, I want it to take on the value of the [2] element of the array, and display it in a textfield within the button.
If you have a moment, do you think you could take a look for me, and steer me in the right direction.
Many thanks