VarsLoad

Kind of class:class
Inherits from:DataLoad < BytesLoad < RetryableLoad < Load < EventDispatcher < CoreObject
Version:07/17/07
Author:Aaron Clinger
Classpath:org.casalib.load.data.VarsLoad
File last modified:Monday, 01 December 2008, 13:34:40
Creates an easy way to load or send and load variables.
Since:
  • Flash Player 7
Example:
  • To load data:
    function onVarsLoad(sender:VarsLoad):Void {
        trace(this.myVarsLoad.getValue("name"));
    }
    
    var myVarsLoad:VarsLoad = new VarsLoad("http://example.com/getData.php");
    myVarsLoad.addEventObserver(this, VarsLoad.EVENT_LOAD_COMPLETE, "onVarsLoad");
    myVarsLoad.start();

    To send and load data:
    function onVarsLoad(sender:VarsLoad):Void {
        trace(this.myVarsLoad.getValue("city"));
    }
    
    var myVarsLoad:VarsLoad = new VarsLoad("http://example.com/getData.php");
    myVarsLoad.addEventObserver(this, VarsLoad.EVENT_LOAD_COMPLETE, "onVarsLoad");
    myVarsLoad.setValue("zip", "94109");
    myVarsLoad.setValue("state", "CA");
    myVarsLoad.start();

Summary


Constructor
  • VarsLoad (path:String, method:String)
    • Defines file and location of load triggered by start.
Class properties
Class properties inherited from DataLoad
Class properties inherited from RetryableLoad
Instance methods
  • setValue (name:String, value:String) : Void
    • Sets a name-value pair to send to the server side script.
  • getValue (name:String) : String
    • Gets the value of a name-value pair defined by loaded variables, if any; or defined by setValue.
  • getLoadVars : LoadVars
    • Gets the LoadVars object defined by the loaded variables, if loaded; or the the LoadVars object populated by setValue, if not loaded.

Constructor

VarsLoad

function VarsLoad (
path:String, method:String)

Defines file and location of load triggered by start.
Parameters:
path :
The absolute or relative URL of the variables to be loaded.
method:
[optional] Defines the method of the HTTP protocol, either "GET" of "POST"; defaults to "POST".

Instance methods

getLoadVars

function getLoadVars (
) : LoadVars

Gets the LoadVars object defined by the loaded variables, if loaded; or the the LoadVars object populated by setValue, if not loaded.
Returns:
  • Returns the LoadVars object.

getValue

function getValue (
name:String) : String

Gets the value of a name-value pair defined by loaded variables, if any; or defined by setValue.
Parameters:
name:
The name of the variable.
Returns:
  • The value of the variable.

setValue

function setValue (
name:String, value:String) : Void

Sets a name-value pair to send to the server side script.
Parameters:
name :
The name of the variable.
value:
The value of the variable.