/ Published in: ActionScript
Just shows the percentage of loaded file in a textfield and fades out the preloader, when loading complete.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
stop(); import caurina.transitions.*; _root.onEnterFrame = function() { trace("onEnterFrame"); a = getBytesTotal(); b = getBytesLoaded(); percent = Math.round(b / a * 100); preloader_mc.status_tf.text = "Loading " + percent + "%"; if (b >= a) { Tweener.addTween(preloader_mc, {_alpha:0, time:1, transition:"easeOutQuint", onComplete: onStartVideo}); delete this.onEnterFrame; } }; function onStartVideo() { trace("onStartVideo()"); preloader_mc._visible = false; gotoAndPlay(1); }