Hi There,
I am currently in the middle of making a preloader for external MP3. I have mish-mashed together a previous preloader with added knowledge about calling streaming MP3s.
On testing the swf, no errors are reported, everything is instantiated, but my preloader bar, just wont go from left to right when it is supposed to.
I honestly honestly cannot fathom it.
The milkybars are on me for anyone who can work out what is going on here!
preloader ref ( preloaderPort_mc.preLoaderfillPort_mc)
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.media.Sound;
import flash.net.URLRequest;
var s:Sound = new Sound();
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded / toLoad;
s.addEventListener(ProgressEvent.PROGRESS, onLoadProgress);
s.addEventListener(Event.COMPLETE, onLoadComplete);
s.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
var req:URLRequest = new URLRequest("http://sarah-hammond.co.uk/01-john_tejada-fractals.mp3");
s.load(req);
if(loaded == toLoad){
function onLoadProgress(event:ProgressEvent):void
{
var loadedPct:uint =
Math.round(100 * (event.bytesLoaded / event.bytesTotal));
preloaderPort_mc.preLoaderfillPort_mc.scaleX = total;
preloaderPort_mc.portPercent_txt.text = loadedPct + "%";
preloaderPort_mc.ofPortBytes_txt.text = loaded + "bytes";
preloaderPort_mc.totalPortBytes_txt.text = toLoad + "bytes";
trace("The sound is " + loadedPct + "% loaded.");
}
function onLoadComplete(event:Event):void
{
var localSound:Sound = event.target as Sound;
s.play();
}
function onIOError(event:IOErrorEvent)
{
trace("The sound could not be loaded: " + event.text);
}
}
Thanks in Advance to anyone who can help,
doodark