Prev | Current Page 627 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


In a real - world application, it is probably desirable also to monitor possible communication errors and to
check the loading status for long transactions.
Loading Variables in Flash 6 to 8
The LoadVars class is used to load values from a server. Once the load() method is executed and the
data has been received, the loaded values will be available as new fields of the LoadVars instance.
import flash.Lib;
import flash.LoadVars;
class Main
{
public static function main()
{
var loader = new LoadVars();
loader.onLoad = function(success)
{
trace(loader.message);
trace(loader.to);
}
loader.load(???variables.txt???);
}
}
Alternatively you can use the MovieClip.loadVariables() method. Its behavior is very similar to the
one described for the LoadVars class; the event to monitor to the data loading is onData . The method
also accepts a second optional argument to designate the HTTP method, GET (default) or POST, used by
the Flash Player to make the request to the server. Once loaded, the variables will be available as new
fields of the invoking MovieClip .


Pages:
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639