Xml.getbytesloaded() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

XML.getBytesLoaded()

Availability
Flash Player 6.
Usage
my_xml.getBytesLoaded() : Number
Parameters
None.
Returns
An integer that indicates the number of bytes loaded.
Description
Method; returns the number of bytes loaded (streamed) for the XML document. You can
compare the value of
percentage of an XML document has loaded.
Example
The following example shows how to use the
XML.getBytesTotal()
the URL parameter of the
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
XML.getBytesTotal()
1026
Chapter 2: ActionScript Language Reference
with the value of
getBytesLoaded()
method to trace the progress of an
command so that the parameter refers to a valid XML file
XML.load()
getBytesTotal()
XML.getBytesLoaded()
XML.load()
to determine what
method with the
command. You must replace

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flash mx

Table of Contents