
Sound.getBytesTotal() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
776
|
ActionScript Language Reference
// Call checkLoadProgress() every 200 milliseconds.
this.loaderID = setInterval(this, "checkLoadProgress", 200);
}
// Usage:
// Create a Sound object.
music = new Sound();
// Assign an onLoad() callback.
music.onLoad = function (success) {
// If the load was successful...
if (success) {
// ...use the new sound.
trace("done loading!");
this.start();
} else {
// ...otherwise, perform failure operations and
// cancel the preload interval (REQUIRED!).
trace("load failed");
this.clearLoadCheck();
}
}
// Assign an onBytesLoaded() callback. This is where each individual
// Sound object can decide what to do with the preload information.
music.onBytesLoaded = function (bytesLoaded, bytesTotal,
kbLoaded, kbTotal, percentLoaded) {
trace("Loading: " + kbLoaded + " of " + kbTotal);
trace(percentLoaded + " percent complete.");
}
// Load a streaming sound.
music.preloadSound("http://www.yoursite.com/sounds/song.mp3", true);
See Also
setInterval(), Sound.getBytesTotal(), Sound.onLoad()
Sound.getBytesTotal() Method
the physical disk size of an external sound file, in bytes
Flash 6
soundObject.getBytesTotal()
Returns
An integer representing the size of the sound file, in bytes. Divide by 1024 to convert bytes
to kilobytes (KB).
Description
The