LoadVars.getBytesTotal( ) Method | Flash 6 |
check the expected total byte size of loading variables |
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.
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( ).
Be careful not to divide by getBytesTotal( ) until it returns some positive integer.
LoadVars.getBytesLoaded( ), LoadVars.load( ), LoadVars.sendAndLoad( )