PDA

View Full Version : Dynamic textfield in button not displaying



John Barbarossa
February 2nd, 2009, 07:35 PM
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 _root.rockets[0][2] (I also tried just plain old rockets[0][2], 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

udin_jelek
February 3rd, 2009, 06:15 AM
sorry i can't speak english well

i have seen your .fla,
- at your "dynamic text", the collor is same with the background, so it's hard i see even the code is right ..
- i'am suggest give the instance name the button or movie clip.. (parent of the instance name) to set the value of "dynamic text"
- and i think or maybe if the var at "dynamic text" like that (array format) it wouldn't work, so change the var at "dynamic text"

substance
February 3rd, 2009, 09:02 AM
Didn't look at you file, but chances are if text is not being displayed it's because the font isn't being embedded.

John Barbarossa
February 7th, 2009, 12:41 PM
Thanks for taking a look at it, guys. I've got it working :)