Using array value in dynamic text field
I'm using C3S Flash and working in a button. The text on the button is set to 'dynamic' and I'm trying to display an array value in the 'var' field.
Is there any way I can use an array value in a dynamic text field? I can display the entire array by putting the 'menuarray' name into the text 'var' field, but if I try to display a subset of the array like 'menuarray[0][1]' it displays nothing, even though this subset holds a value (it shows up fine in the trace window).
Is there any way to get around creating dozens of variables just to display array items?
TIA
RonM
Using array value in dynamic text field
Hello Rob:
Thanks for that sample file...very helpful... I've looked at it and it makes perfect sense. However I still cannot get this to work in my file.
The difference may be that your buttons are movie clips, whereas mine are buttons with three states created in the button editor. I've basically copied/pasted your code and tried to apply it to my buttons ( I change the instance names to match yours ) but it still does not name the buttons from the array.
Do I need to use 'movie clip' buttons to do this instead of button buttons? This is the code I'm using with mine remmed out on top:
var menuArray:Array = ["BUTTON 1", "BUTTON 2", "BUTTON 3"];
btn1.dt.text = btnArray[0];
stop();
//var menuArray:Array = new Array(new Array("What is WHMIS?","Overview","What is WHMIS?","WHMIS is Law","Review","Self Test"), new Array("three", "fouryy"));
//trace(menuArray);
//trace(menuArray[0][0]);
//btn1.dt.text = menuArray[0][0];
1 Attachment(s)
Using array value in dynamic text field
Yes, 'dt' is the name of the dynamic text field. I'm uploading the file......didn't know I could do this. I think I've done it right... let me know if you don't see it.
I notice you're in Canada... I'm in Maple Ridge BC.
RonM
Using array value in dynamic text field
OH OK thanks for all your help!
Question: If I use vars I'm going to need many of them which will pretty well defeat the purpose of using an array for efficiency. I'm assuming I should just learn movieclip buttons...can I create a three state movieclip button similar to real buttons? What would you recommend in a case like this... part/modules buttons for a training course - would movieclips do the job or should I just stick with the buttons? What would you do?
Thanks again for all your help
RonM
using array value in dynamic text field
I found a tutorial and have built the button in a movie clip... I can now get the array value into the button in the '_up' state but it disappears when I move to the '_over' or '_down' state, even though both are set to 'dt' instance name in the dynamic text field. Other than that little glitch it looks good.
RonM
using array value in dynamic text field
Perfect! Thanks again for you help.
RonM:cap: