03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example<br />

The following example loads information from a text file called params.txt into the<br />

target_mc movie clip that is created using createEmptyMovieClip(). The setInterval()<br />

function is used to check the loading progress. The script checks for a variable in the<br />

params.txt file named done.<br />

this.createEmptyMovieClip("target_mc", this.getNextHighestDepth());<br />

loadVariables("params.txt", target_mc);<br />

function checkParamsLoaded() {<br />

if (target_mc.done == undefined) {<br />

trace("not yet.");<br />

} else {<br />

trace("finished loading. killing interval.");<br />

trace("-------------");<br />

for (i in target_mc) {<br />

trace(i+": "+target_mc[i]);<br />

}<br />

trace("-------------");<br />

clearInterval(param_interval);<br />

}<br />

}<br />

var param_interval = setInterval(checkParamsLoaded, 100);<br />

The external file, params.txt, includes the following text:<br />

var1="hello"&var2="goodbye"&done="done"<br />

See also<br />

loadVariablesNum function, loadMovie function, loadMovieNum function, getURL<br />

function, loadMovie (MovieClip.loadMovie method), loadVariables<br />

(MovieClip.loadVariables method), load (LoadVars.load method)<br />

loadVariablesNum function<br />

loadVariablesNum(url:String, level:Number [, method:String]) : Void<br />

Reads data from an external file, such as a text file or text generated by ColdFusion, a CGI<br />

script, ASP, PHP, or a Perl script, <strong>and</strong> sets the values for variables in a Flash Player level. You<br />

can also use this function to update variables in the active SWF file with new values.<br />

The text at the specified URL must be in the st<strong>and</strong>ard MIME format application/x-wwwform-urlencoded(a<br />

st<strong>and</strong>ard format used by CGI scripts). Any number of variables can be<br />

specified. For example, the following phrase defines several variables:<br />

company=Macromedia&address=601+Townsend&city=San+Francisco&zip=94103<br />

Global Functions 59

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!