LoadVars.toString( ) Method

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
LoadVars.toString( ) Method Flash 6

retrieve the same URL-encoded string of variables that would be sent by send( ) or sendAndLoad( )
loadVarsObject.toString()

Returns

A string of URL-encoded variables.

Description

The toString( ) method returns the enumerable properties of loadVarsObject as a string of URL-encoded variables (the enumerable properties are those exposed to a for-in loop). It returns the same data that would be sent to a server script in a send( ) or sendAndLoad( ) call, which is handy for debugging. Properties are added to the returned string in the reverse order of their creation (the most recently created property is first in the string, followed by the second most recently created, and so on). Each property's value is converted to a string before being URL encoded.

Example

loadedVars = new LoadVars(); loadedVars.day = 22; loadedVars.month = "Feb."; loadedVars.year = 2002;     // Displays: year=2002&month=Feb%2E&day=22 // Notice that the '.' after "Feb" is converted to the hex value %2E. // See the Description heading of the LoadVars class for details on URL encoding trace(loadedVars.toString());

See Also

LoadVars.onLoad( ), LoadVars.send( ), LoadVars.sendAndLoad( )



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net