# Riddle me This!

**URL:** <https://forum.kirupa.com/t/riddle-me-this/282186>\
**Category:** flash\
**Created:** [February 18, 2009, 6:45pm UTC](https://forum.kirupa.com/t/riddle-me-this/282186 "2009-02-18T18:45:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![doodark](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@doodark](https://forum.kirupa.com/u/doodark)\
**Post date:** [February 18, 2009, 6:45pm UTC](https://forum.kirupa.com/t/riddle-me-this/282186/1 "2009-02-18T18:45:44Z")

</div>

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)

```auto
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
