Getbytesloaded (Xml.getbytesloaded Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

getBytesLoaded (XML.getBytesLoaded method)

public getBytesLoaded() : Number
Returns the number of bytes loaded (streamed) for the XML document. You can compare the
value of
getBytesLoaded()
percentage of an XML document has loaded.
Availability: ActionScript 1.0; Flash Player 6
Returns
- An integer that indicates the number of bytes loaded.
Number
Example
The following example shows how to use the
XML.getBytesTotal()
replace the URL parameter of the
valid XML file using HTTP. If you attempt to use this example to load a local file that resides
on your hard disk, this example will not work properly because in test movie mode Flash
Player loads local files in their entirety.
// create a new XML document
var doc:XML = new XML();
var checkProgress = function(xmlObj:XML) {
var bytesLoaded:Number = xmlObj.getBytesLoaded();
var bytesTotal:Number = xmlObj.getBytesTotal();
var percentLoaded:Number = Math.floor((bytesLoaded / bytesTotal ) 100);
trace ("milliseconds elapsed: " + getTimer());
trace ("bytesLoaded: " + bytesLoaded);
trace ("bytesTotal: " + bytesTotal);
trace ("percent loaded: " + percentLoaded);
trace ("---------------------------------");
}
doc.onLoad = function(success:Boolean) {
clearInterval(intervalID);
trace("intervalID: " + intervalID);
}
doc.load("[place a valid URL pointing to an XML file here]");
var intervalID:Number = setInterval(checkProgress, 100, doc);
See also
getBytesTotal (XML.getBytesTotal method)
1294
ActionScript classes
with the value of
method to trace the progress of an
XML.load()
to determine what
getBytesTotal()
XML.getBytesLoaded()
XML.load()
command so that the parameter refers to a
method with the
command. You must

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF