# Streaming Music a little more complex

**URL:** <https://forum.kirupa.com/t/streaming-music-a-little-more-complex/243305>\
**Category:** flash\
**Created:** [November 5, 2007, 4:16pm UTC](https://forum.kirupa.com/t/streaming-music-a-little-more-complex/243305 "2007-11-05T16:16:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wahiche](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wahiche](https://forum.kirupa.com/u/wahiche)\
**Post date:** [November 5, 2007, 4:16pm UTC](https://forum.kirupa.com/t/streaming-music-a-little-more-complex/243305/1 "2007-11-05T16:16:03Z")

</div>

Here is what I want to do. If you want to see the site I need to attach the music to it is located at [www.buildingbodiestv.com.](http://www.buildingbodiestv.com)

The menu is created in Flash and I want to add a play and stop button so that the theme music can be stopped if necessary. The issue that I always have is that when I would change a page lets say from home to bios, the music would stop and restart from the beginning. What I am trying to accomplish is that it does not do that but when changing pages it continues to play the music from where it left off, or just continue playing the current audio.

Is there a way that I can get the position of the music playing then pass that to start where it left off. This is the code I have so far.

```auto
var soundPos = 0;

if (soundPos == 0){
plpSound = new Sound(this);
plpSound.attachSound("theme");
plpSound.start(soundPos, 99);
plpSound.setVolume(30);
}else{
    plpSound.start(soundPos,1);
}

play_btn.onRelease = function() {
    trace(soundPos);
    if (soundPos == 0){
    stopAllSounds();
    plpSound.start(0, 99);
    plpSound.setVolume(30);
    }else{
        plpSound.start(soundPos/100,1);
    }
};
stop_btn.onRelease = function() {
    soundPos = plpSound.position;
    trace(soundPos);
    stopAllSounds();
}

```

Thanks in advance.
