# Loading new mp3 to replace current

**URL:** <https://forum.kirupa.com/t/loading-new-mp3-to-replace-current/243293>\
**Category:** Uncategorized\
**Created:** [November 5, 2007, 3:07pm UTC](https://forum.kirupa.com/t/loading-new-mp3-to-replace-current/243293 "2007-11-05T15:07:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crobar](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/crobar/32/2073_2.png) [@crobar](https://forum.kirupa.com/u/crobar)\
**Post date:** [November 5, 2007, 3:07pm UTC](https://forum.kirupa.com/t/loading-new-mp3-to-replace-current/243293/1 "2007-11-05T15:07:05Z")

</div>

im just starting out with as3 my first projects are to rebuild alot of my old as projects.  
im starting with an mp3 player…  
[FONT=Courier New][LEFT]

```
 [FONT=Courier New][LEFT]

```

```auto
var musicURL:URLRequest = new URLRequest("music.mp3");
var sndMusic:Sound = new Sound(musicURL);
var channel1:SoundChannel = new SoundChannel();

function stopClick(evt:Event):void {
channel1.stop();
}
bStop.addEventListener(MouseEvent.CLICK, stopClick);

function playmusicClick(evt:Event):void {
channel1.stop();
channel1 = sndMusic.play();
}
bMusicPlay.addEventListener(MouseEvent.CLICK, playmusicClick);

//LOAD NEW MP3 INTO CHANNEL 1

function playmusicClick2(evt:Event):void {

<b>musicURL=URLRequest("music.mp3");
sndMusic=Sound(musicURL);</b>

channel1.stop();
channel1 = sndMusic.play();
}
bMusicPlay2.addEventListener(MouseEvent.CLICK, playmusicClick2);

```

[/LEFT]  
[/FONT]

im having trouble reusing the urlrequest, sound on channel1.  
it works if i recreate the objects URL request and Sound

```auto
function playmusicClick2(evt:Event):void {
channel1.stop();
var musicURL:URLRequest = new URLRequest("music2.mp3");
var sndMusic:Sound = new Sound(musicURL);
channel1 = sndMusic.play();
}
bMusicPlay2.addEventListener(MouseEvent.CLICK, playmusicClick2);

```

im guessing i would be able to reuse the already created URLRequest and Sound objects correct?  
how would i reuse those objects?

thanks for any help!

[/LEFT]  
[/FONT]
