LoadVars


Object
    |
    +-LoadVars

public dynamic class LoadVars
extends Object

You can use the LoadVars class to obtain verification of successful data loading and to monitor download progress. The LoadVars class is an alternative to the loadVariables() function for transferring variables between a Flash application and a server.

The LoadVars class lets you send all the variables in an object to a specified URL and to load all the variables at a specified URL into an object. It also lets you send specific variables, rather than all variables, which can make your application more efficient. You can use the LoadVars.onLoad handler to ensure that your application runs when data is loaded, and not before.

The LoadVars class works much like the XML class; it uses the load(), send(), and sendAndLoad() methods to communicate with a server. The main difference between the LoadVars class and the XML class is that LoadVars transfers ActionScript name and value pairs, rather than an XML Document Object Model (DOM) tree stored in the XML object. The LoadVars class follows the same security restrictions as the XML class.

Availability: ActionScript 1.0; Flash Player 6

See also

loadVariables function, onLoad (LoadVars.onLoad handler), XML

Property summary

Modifiers

Property

Description

 

contentType:String

The MIME type that is sent to the server when you call LoadVars.send() or LoadVars.sendAndLoad().

 

loaded:Boolean

A Boolean value that indicates whether a load or sendAndLoad operation has completed, undefined by default.

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)


Event summary

Event

Description

onData = function(src:String) {}

Invoked when data has completely downloaded from the server or when an error occurs while data is downloading from a server.

onHTTPStatus = function(httpStatus:Number) {}

Invoked when Flash Player receives an HTTP status code from the server.

onLoad = function(success:Boolean) {}

Invoked when a LoadVars.load() or LoadVars.sendAndLoad() operation has ended.

Constructor summary

Signature

Description

LoadVars()

Creates a LoadVars object.

Method summary

Modifiers

Signature

Description

 

addRequestHeader(header:Object, headerValue:String) : Void

Adds or changes HTTP request headers (such as Content-Type or SOAPAction) sent with POST actions.

 

decode(queryString:String) : Void

Converts the variable string to properties of the specified LoadVars object.

 

getBytesLoaded() : Number

Returns the number of bytes downloaded by LoadVars.load() or LoadVars.sendAndLoad().

 

getBytesTotal() : Number

Returns the total number of bytes downloaded by LoadVars.load() or LoadVars.sendAndLoad().

 

load(url:String) : Boolean

Downloads variables from the specified URL, parses the variable data, and places the resulting variables in my_lv.

 

send(url:String, target:String, [method:String]) : Boolean

Sends the variables in the my_lv object to the specified URL.

 

sendAndLoad(url:String, target:Object, [method:String]) : Boolean

Posts variables in the my_lv object to the specified URL.

 

toString() : String

Returns a string containing all enumerable variables in my_lv, in the MIME content encoding application/x-www-form-urlencoded.

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)



Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001777.html