Groups | Blog | Home
all groups > flash data integration > december 2006 >

flash data integration : trying to load external data


eriesurfer
12/12/2006 2:34:28 AM
ive read the tutorials and searched the forums but i still need some help. im
trying to read data from a text file here
(http://www.ndbc.noaa.gov/data/realtime2/41035.spec) what i cant figure out is
how to call each value to its own dynamic text field.
YYYY MM DD hh mm H0 SwH SwP WWH WWP SwD WWD STEEPNESS AVP MWD
2006 12 10 00 00 0.3 0.3 6.2 0.1 3.2 ESE SE N/A 6.1 110
2006 12 09 23 00 0.3 0.3 9.1 0.1 3.6 SE SE N/A 6.2 134
2006 12 09 22 00 0.3 0.3 9.1 0.1 3.6 SE ESE N/A 6.2 125
2006 12 09 21 00 0.3 0.3 7.1 0.1 3.4 ESE ESE N/A 5.9 119:confused;
MotionMaker
12/12/2006 3:55:33 PM
You can use XML or LoadVars. LoadVars is the simplier. The example in help is
real good to look at and then you can form a more specific question. But in
general with LoadVars, your file will have a variable associated with each
value and that variable name can be linked to a Flash dynamic TextField.

http://livedocs.macromedia.com/flash/8/main/00002334.html


eriesurfer
12/13/2006 8:52:37 PM
MotionMaker
12/14/2006 1:43:25 PM
Perhaps the LoadVars.load method documentation may be easier:

http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?hr
ef=00002334.html

Here is the example from that link modified slightly:

var my_lv:LoadVars = new LoadVars();
my_lv.onLoad = function(success:Boolean) {
if (success) {
trace(this.toString());
textField1_txt.text = this.var1

textField2_txt.text = this.var2
textField3_txt.text = this.var3
textField4_txt.text = this.var4
} else {
trace("Error loading/parsing LoadVars.");
}
};
my_lv.load("http://domain/loadvarsfile.txt");

As you can see in the example you set your dynamic TextFields equal to the
vars in the loaded file.

The other part of the equation is the loaded vars file which might be
var1=1234&var2=Hello&var3=12/1/2006&var4=Blah blah blah

AddThis Social Bookmark Button