LoadVars.getBytesTotal( ) Method

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

check the expected total byte size of loading variables
loadVarsObject.getBytesTotal()

Returns

The total number of bytes being transferred as a result of a load( ) or sendAndLoad( ) call, or undefined before the number of bytes is determined.

Description

The getBytesTotal( ) method tells us the expected total byte size of the current variable transfer. For a new LoadVars object, getBytesTotal( ) returns undefined. Immediately after load( ) or sendAndLoad( ) are called, getBytesTotal( ) continues to return undefined until the size of the variables being loaded is determined (normally within a second). It then returns the total byte size of the loading variables until the next call to load( ) or sendAndLoad( ). If the total byte size cannot be determined (for example, due to a missing Content-Length in an HTTP response header), getBytesTotal( ) continues to return undefined. To convert bytes to kilobytes (KB), divide by 1024.

For an example that uses getBytesTotal( ) to create a variable preloader, see Example 18-1 under LoadVars.getBytesLoaded( ).

Usage

Be careful not to divide by getBytesTotal( ) until it returns some positive integer.

See Also

LoadVars.getBytesLoaded( ), LoadVars.load( ), 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