# "Invalid Sound" madness with an external preloader

**URL:** <https://forum.kirupa.com/t/invalid-sound-madness-with-an-external-preloader/303929>\
**Category:** flash\
**Created:** [January 29, 2010, 4:20am UTC](https://forum.kirupa.com/t/invalid-sound-madness-with-an-external-preloader/303929 "2010-01-29T04:20:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mickster](https://avatars.discourse-cdn.com/v4/letter/m/a9adbd/32.png) [@Mickster](https://forum.kirupa.com/u/Mickster)\
**Post date:** [January 29, 2010, 4:20am UTC](https://forum.kirupa.com/t/invalid-sound-madness-with-an-external-preloader/303929/1 "2010-01-29T04:20:42Z")

</div>

I’ve just made a preloader, which is a separate file that loads the main movie. When I try to compile the preloader, I get:

ArgumentError: Error #2068: Invalid sound.

All the code for the streaming sounds is contained in the main movie, and when I compile the main movie directly it finds all the sounds and plays them with no problem. It’s only when I try to compile the preloader that I get the problem.

Here’s the relevant stuff from the main movie:

```auto
 
 import flash.display.MovieClip;
 import flash.events.*;
 import flash.media.Sound;
 import flash.media.SoundChannel;
 import flash.media.SoundTransform;
 import flash.utils.*;
 import flash.net.URLLoader;
 import flash.net.URLRequest;
private var musicCount:int = (0);
var mySong0:URLRequest = new URLRequest("music/music_0.mp3");
var sound0:Sound = new Sound();
var mySoundChannel_0:SoundChannel = new SoundChannel();
sound0.load(mySong0);
 function playMusic(){
 if (musicCount == 0){
 mySoundChannel_0 = sound0.play(0,1000);
 //Prevents the function from looping
 musicCount++
 }
}

```

And here’s the preloader movie. It scales a progress bar - the movie clip called bar\_mc - while it load the main movie:

```auto
 
var myrequest:URLRequest=new URLRequest("microbe_muncher_070.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
myloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progresshandler);
function progresshandler(myevent:ProgressEvent):void {
var myprogress:Number=myevent.target.bytesLoaded/myevent.target.bytesTotal;
  bar_mc.scaleX=myprogress;
 percentage_text.text=Math.round(myprogress*100)+"%";
}
myloader.contentLoaderInfo.addEventListener(Event.COMPLETE, finished);
function finished(myevent:Event):void { 
 addChild(myloader);
 removeChild(percentage_text);
 removeChild(bar_mc);
 removeChild(background_mc);
}

```
