LoadVars.getBytesLoaded()
319
trace(my_lv.toString());
// Iterate over properties in my_lv
for (var prop in my_lv) {
trace(prop+" -> "+my_lv[prop]);
}
See also
LoadVars.onData
,
XML.parseXML()
LoadVars.getBytesLoaded()
Availability
Flash Player 6.
Usage
my_lv
.getBytesLoaded()
: Number
Parameters
None.
Returns
An integer.
Description
Method; returns the number of bytes downloaded by
LoadVars.load()
or
LoadVars.sendAndLoad()
. This method returns
undefined
if no load operation is in progress
or if a load operation has not yet begun.
Example
The following example uses a ProgressBar instance and a LoadVars object to download a text file.
When you test the file, two things write to the log file: whether the file loads successfully and how
much data loads into the SWF file. You must replace the URL parameter of the
LoadVars.load()
command so that the parameter refers to a valid text 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. To see this
code work, add a ProgressBar instance called
loadvars_pb
to the Stage. Then add the following
ActionScript:
var loadvars_pb:mx.controls.ProgressBar;
var my_lv:LoadVars = new LoadVars();
loadvars_pb.mode = "manual";
this.createEmptyMovieClip("timer_mc", 999);
timer_mc.onEnterFrame = function() {
var lvBytesLoaded:Number = my_lv.getBytesLoaded();
var lvBytesTotal:Number = my_lv.getBytesTotal();
if (lvBytesTotal != undefined) {
trace("Loaded "+lvByte" of "+lvByt" bytes.");
loadvars_pb.setProgress(lvBytesLoaded, lvBytesTotal);
}
};
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...