Search Tutorials
Text File A practical application for this dynamic graph is to import data from a text file that is updated regularly. (you can have the server side programmers deal with writing the programs to update the actual text file on the fly, but that type of development is another tutorial in itself :) We can make use of flash 4's loadmovie action script, and select the load variables into location option. What this function does is what it suggests - it takes in data from a text file and makes it accessable in flash. But for this feature you must specify where you'd like to load the variables. (you have a choice to load them into a movie level, or a target pathname). In this case we'll load them into _level0 because we'd like them to be easily visible and accessable for our dynamic graph program (hmm! I just called an .fla a program!) And of course you would not need to populate your graph with random numbers. So omit the randomly generated variable script in frame 1 of the "script" layer. You also won't need to loop back to frame one either so just delete the "refresh" layer completely. The stop action in Frame 3 needs to be replaced with a go to and play (2) action. This will perform a check to ensure the data is loaded. Note: the data in the text file must be in a standard MIME format application/x-www-urlformencoded (in plain english.. this is a common format used to communicate with cgi.. its very simple..) and must also come with its complete URL (eg http://www.flashkit.com/data/data.txt).
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|