-
Help with array and text.
Hi, I'm new to flash mx 2004 and I'm trying to get a simple program to work where you press a button, and the name of the month changes to the next month, but I can't seem to get the code working.
months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','S ep','Oct','Nov','Dec'];
i=0;
B3.onRelease=function(){
if(i>10){
i=0;
}else{
i++;
}
trace(i);
trace(months[i]);
}
When I test the movie, I get an output on the output screen but it doesn't change the text in the dynamic text box. I'm sure the names are labled correctly, and I made the text box dynamic, why won't months show up in the text box?
-
magnetologicus
your code works fine just add a dynamic textfield which in this case i call it msg
Code:
months=['Jan','Feb','Mar','Apr','May','Jun','Jul',
'Aug','Sep','Oct','Nov','Dec'];
i=0;
B3.onRelease=function(){
if(i>10){
i=0;
}else{
i++;
}
msg=months[i];
}
-
I still can't get it to work, it's displaying the months in the output box but it's not changing the text in the dynamic text box at all.
-
magnetologicus
ok its because you have to name your textfield
or else flash dont know where to output it
here is how you name your dybamic textfield
select the text tool and make a the textbox
then open the properties panel
on the right next to "var" there is a white space enter (type) a variable name i used msg
that ought work
-
Yay! It's working! Thank you for the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|