|
|
|
|
|
| ||
|
n99creations
View Snippet | ||
|
_recordDownloadSpeed (Object._recordDownloadSpeed method)
Creator: nathan99 Date Added: May 13, 2007 Rating: 100% (4 of 4 Votes) Description: Monitors how fast an Object is downloading, updating at one second intervals. This does not return any value, rather it makes a new property on the Object named _downloadSpeed which can be accessed to retrieve the download speed of the Object. The _recordDownloadSpeed() method can be used to track the download speed of any Object that can access the getBytesLoaded() method. Example The following example creates a new Sound() object, begins to load myMP3File.mp3 and then calls the Object._recordDownloadSpeed() method to monitor how fast the mp3 is downloading. An interval is set up to output the download speed (in kilobits per second) into the output dialogue box and calling the Object._downloadSpeed parameter: Actionscript Code:
Object.prototype._recordDownloadSpeed = function():Void {
clearInterval(this.getRate); this.getRate = setInterval(function (target):Void { target.dist = target.dlspeed ? target.getBytesLoaded()-target.dlspeed : target.getBytesLoaded(); target._downloadSpeed = Math.round(target.dist/1024); target.dlspeed = target.getBytesLoaded(); }, 1000, this); }; my_sound = new Sound(); my_sound.loadSound("./myMP3File.mp3"); my_sound._recordDownloadSpeed(); setInterval(function ():Void { trace(my_sound._downloadSpeed); }, 1000); ![]()
There are no comments to display.
iTunes Coverflow (609 votes) iTunes Coverflow... (277 votes) Mac OSX Tsunami ... (113 votes) Rotating Menu (47 votes) 3D Rotating Tree (33 votes) BitmapData fade ... (18 votes) Water ripples wi... (18 votes) iTunes Coverflow... (18 votes) Vertical Menu (16 votes) Sliding menu (14 votes)
shuffle (Array.s... (6 votes) _recordDownloadS... (4 votes) Pagination (3 votes) ordinalise funct... (2 votes) distanceBetween ... (1 votes) Here at n99creations, we love donations =] |