Hello --
I am new to Flash but have some VB experience. I am trying to make a simple (or so I thought!) movie that's basically a text box displaying a list of current events, one by one. I want to store the events in an array, and then have the first one display for a few seconds, then go to the next array item, then the next, and so on.
I have a movie, with 2 layers: Actions and Display. My code so far is in the first frame of the actions layer.
The Display layer contains a dynamic text box set to the variable "newsitem" - this is where I want to display my events.
I have a text file (news.txt) containing the events, each event separated by a carat ("^"
.
Contents of text file:
txtmsg=October 20-21, 2002 FIN User Conference, Van Nuys, CA^November 2-3, 2002 Vancouver Tech Conference, Vancouver, BC^December 4-5, 2002 Another Trade Show, New York, NY
I load the text file contents into a Flash variable (txtmsg) (this part works fine). I then use the split function to separate out each event into its own array item. It works fine (meaning when I test the movie, and choose Debug - List Variables, each event is listed as an array item.)
BUT, if I add more frames to the display layer, and test the movie again, the array is undefined. For some reason the variable txtmsg still contains all the events.
Here's my code from frame 1 of the actions layer:
loadVariablesNum ("news.txt", 0, "POST"
;
mycounter = 0;
newsarray = txtmsg.split('^');
newsitem=newsarray[mycounter];
My plan was to add maybe 20 frames, where the first newsarray item would display, then add another piece of actionscript in frame 20 something like this:
mycounter++;
newsitem=newsarray[mycounter];
gotoAndPlay (2);
then just have it loop
I don't know if by adding more frames, somehow the variable containing the array is going out of scope, or what!
Can someone please help?
Thanks!
Kathy
I am new to Flash but have some VB experience. I am trying to make a simple (or so I thought!) movie that's basically a text box displaying a list of current events, one by one. I want to store the events in an array, and then have the first one display for a few seconds, then go to the next array item, then the next, and so on.
I have a movie, with 2 layers: Actions and Display. My code so far is in the first frame of the actions layer.
The Display layer contains a dynamic text box set to the variable "newsitem" - this is where I want to display my events.
I have a text file (news.txt) containing the events, each event separated by a carat ("^"
Contents of text file:
txtmsg=October 20-21, 2002 FIN User Conference, Van Nuys, CA^November 2-3, 2002 Vancouver Tech Conference, Vancouver, BC^December 4-5, 2002 Another Trade Show, New York, NY
I load the text file contents into a Flash variable (txtmsg) (this part works fine). I then use the split function to separate out each event into its own array item. It works fine (meaning when I test the movie, and choose Debug - List Variables, each event is listed as an array item.)
BUT, if I add more frames to the display layer, and test the movie again, the array is undefined. For some reason the variable txtmsg still contains all the events.
Here's my code from frame 1 of the actions layer:
loadVariablesNum ("news.txt", 0, "POST"
mycounter = 0;
newsarray = txtmsg.split('^');
newsitem=newsarray[mycounter];
My plan was to add maybe 20 frames, where the first newsarray item would display, then add another piece of actionscript in frame 20 something like this:
mycounter++;
newsitem=newsarray[mycounter];
gotoAndPlay (2);
then just have it loop
I don't know if by adding more frames, somehow the variable containing the array is going out of scope, or what!
Can someone please help?
Thanks!
Kathy