# Reusing/redefine URLRequest & Sound

**URL:** <https://forum.kirupa.com/t/reusing-redefine-urlrequest-sound/243924>\
**Category:** flash\
**Created:** [November 12, 2007, 5:24pm UTC](https://forum.kirupa.com/t/reusing-redefine-urlrequest-sound/243924 "2007-11-12T17:24:02Z")\
**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 12, 2007, 5:24pm UTC](https://forum.kirupa.com/t/reusing-redefine-urlrequest-sound/243924/1 "2007-11-12T17:24:02Z")

</div>

[SIZE=2]im just starting out with as3, my first project is a mp3 player…

```auto

ar 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);

```

[/SIZE][FONT=Courier New][SIZE=2] im having trouble reusing the URLRequest & Sound on channel1.  
it works if i recreate the objects URL request and Sound  
like this:

```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);

```

but is there a way to redefine and reuse the  
musicURL and sndMusic without recreating them?

thanks for any help  
[/SIZE][/FONT]
