View Full Version : Dynamic text - set up counter to swap text displayed from text file?
09-16-2003, 01:39 PM
I am trying to set up a SWF that has a dynamic text field for announcements. The number of announcements will vary and the text file will be updated by someone who will not have access to the Flash file. I'm trying to set the file up so that there is 1 dynamic text block "announce" and a counter that can read the number of "announce"s in the text file. The animation will go back and repeat the display of the text field until there are no more "announcements" left in the text file, then will quit and go back to the beginning of the movie. Is this possible to do? The other thing that I have tried is a scrolling text box.....which works until I get to the end of the list of text, but then I can't get the movie to unload. Thank you in advance for the help.
09-16-2003, 04:01 PM
Yes, what you want to do is acheivable. The first thing you need to do is decide how to store the data externally so that it can be loaded into Flash. You can either load the data from a variables file or an XML file. I think I'd use the XML file because it's easy to use and you don't need a separate variable to count the number of announcements. When the XML data is loaded and parsed, Flash will know immediately how many announcements are loaded.
Here's a couple of good tutorials to start with:
Once you have the data loaded, you can scroll the text:
Hope this helps get you started...
09-17-2003, 07:58 PM
Thank you for the link to the tutorials. I started a file and *think* I am closer, but am still having issues (surprise surprise). I set up a file that has 6 dynamic text fields that load on different frames in the timeline. Each variable is named "announce1", "announce2", and so on with the frame label corresponding to the variable that's being loaded. In my external text file "text.txt", I have the following:
&announce1 = blah
&announce2 = blah
&announce3 = blah
so that the user would input his own text for the announcements and then add the total number of announcements that he has. The first frame of the movie loads the external text file. So far no problem, the movie plays with all of the dynamic text loading. The only thing is that I don't want to have to wait through the entire movie for announcements 4, 5 and 6 when there are only 3 announcements. So I set up an action right before 'announce1' loads which is:
totalAnnounce = Number(totalAnnounce)
count = totalAnnounce
thinking that it would assign the numeric value of "&totalAnnounce=3" to the count.
After 'announce1' finishes displaying and before "announce2" starts, I put this action:
if (count > 2)
thinking that I would keep entering this code before each dynamic text field is loaded to check on how many announcements there were and upping the count and changing the "announce#". If there more it would play the next section otherwise the movie would go back to the beginning again. I'm sure I'm making some dumb error and this is probably a piece of cake to all knowledgable Flash developers, but I just don't have the Flash know-how to solve this! (and I've been going round and round and round.....no Flash developers here with me)
Thanks again in advance.
vBulletin® v3.8.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.