# Loading Sound with URLLoader

**URL:** <https://forum.kirupa.com/t/loading-sound-with-urlloader/305236>\
**Category:** flash\
**Created:** [February 22, 2010, 3:51am UTC](https://forum.kirupa.com/t/loading-sound-with-urlloader/305236 "2010-02-22T03:51:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![worthington747](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@worthington747](https://forum.kirupa.com/u/worthington747)\
**Post date:** [February 22, 2010, 3:51am UTC](https://forum.kirupa.com/t/loading-sound-with-urlloader/305236/1 "2010-02-22T03:51:53Z")

</div>

I am loading a sound file with the URLLoader class passed to the URLRequest class, just as one would load any other external content type.

```auto
var loader:URLLoader=new URLLoader;
loader.load(new URLRequest("file.mp3"));

```

When the loading is complete I would like to pass the data to a Sound Object.

```auto
var mySound:Sound=e.currentTarget.data

```

The object returned on the complete event is of type [flash.net](http://flash.net)::URLLoader.

```auto
e.currentTarget

```

How can I turn this URLLoader into a Sound Object?

Any help would be greatly appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![Thiago\_Camargo](https://avatars.discourse-cdn.com/v4/letter/t/edb3f5/32.png) [@Thiago\_Camargo](https://forum.kirupa.com/u/Thiago_Camargo)\
**Post date:** [February 15, 2016, 10:43am UTC](https://forum.kirupa.com/t/loading-sound-with-urlloader/305236/2 "2016-02-15T10:43:32Z")

</div>

Old topic, but the solution would be to change your data format for loading to binary with:

> loader.dataFormat = URLLoaderDataFormat.BINARY;

Then when the loading is complete you should use the loadCompressedDataFromByteArray method like this:

> var sound:Sound = new Sound();  
> sound.loadCompressedDataFromByteArray(event.target.data,event.target.data.length);
