# Song Position Reset

**URL:** https://forum.kirupa.com/t/song-position-reset/7516
**Category:** flash
**Created:** [November 1, 2002, 11:31pm UTC](https://forum.kirupa.com/t/song-position-reset/7516 "2002-11-01T23:31:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)
#### Post date: [November 1, 2002, 11:31pm UTC](https://forum.kirupa.com/t/song-position-reset/7516/1 "2002-11-01T23:31:44Z")

</div>

I need to reset my song position after the 1st song has played for 5 sec.

if (myMusic.position\>5000 ) {  
myMusic.position=0;  
combobox.setselectedindex(combobox.getselectedindex()+1);}

This is an auto play function that changes songs after 5 seconds.

What happens with the code above is after 5 sec the next song is selected and the position goes to 0 and then immediately back to 5 sec and continues counting up.

Any ONE…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2002, 9:10am UTC](https://forum.kirupa.com/t/song-position-reset/7516/2 "2002-11-02T09:10:23Z")

</div>

All right,

Have I asked to many questions?

Cherp Cherp------Cherp Cherp  
:nerd:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 2, 2002, 10:00am UTC](https://forum.kirupa.com/t/song-position-reset/7516/3 "2002-11-02T10:00:23Z")

</div>

could u tell us the aim of that one, maybe we could find a simpler way! =)

yours,

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [November 4, 2002, 5:36am UTC](https://forum.kirupa.com/t/song-position-reset/7516/4 "2002-11-04T05:36:43Z")

</div>

mySound = new Sound();  
mySound.loadSound(“music.mp3”,true);

Or

mySound = new Sound();  
mySound.attachSound(“mySound01”);

With the attachsound code I can also use this code  
mySound.start(0,999);

Which tells flash to start the song at 0 and loop forever.

How can I do this same concept with loadSound?  
😏

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 9:07pm UTC](https://forum.kirupa.com/t/song-position-reset/7516/5 "2003-05-23T21:07:07Z")

</div>

Hey everyone,  
Expanding upon his question, is there a way for me to find out the maximum duration of a sound so that I can loop it using a similiar line such as this:  
[AS]if (myMusic.position\>5000 ) {[/AS]

Basically, I am trying to loop the following sound loop using an MP3 loaded from an external source: [AS]mySound.loadSound(“sound1.mp3”, true);[/AS]

Unfortunately, mySound.start(offset, loop) does not work with sounds loaded from an external source…or am I making a mistake somewhere?

Thanks!  
Kirupa :bandit:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 9:29pm UTC](https://forum.kirupa.com/t/song-position-reset/7516/6 "2003-05-23T21:29:29Z")

</div>

There’s mySound.duration to find the duration of the song.

But as far as I know… mySoundObject.start() should work with externally loaded music as well.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 23, 2003, 9:32pm UTC](https://forum.kirupa.com/t/song-position-reset/7516/7 "2003-05-23T21:32:02Z")

</div>

Ok here we go Kirupa, this info was taken from [www.kennybellew.com](http://www.kennybellew.com) (the ultimate sound object tutorial)…

> All of the controls for sound objects described thus far work for dynamically-loaded streaming MP3’s, with the exception of starting the MP3 with the mySoundObject.start() method. Streaming MP3’s start as soon as there is enough data to play the sound; therefore, the loadSound call to the sound object is the start command. However, you should be able to stop the streaming sound and restart it with the mySoundObject.start() call. Currently, this option is only partially available due to a bug in the Flash Player.

With the r40 release of version 6 Flash player, this issue was addressed. If you are going to use the mySoundObject.start() method to restart the streaming sound object, you must make sure that the user has the latest Flash player. The Flash Deployment Kit from Macromedia provides instructions on making sure the latest plug-in is installed on the user’s computer.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 24, 2003, 12:30am UTC](https://forum.kirupa.com/t/song-position-reset/7516/8 "2003-05-24T00:30:01Z")

</div>

Thanks a bunch lost. The problem was that I had streaming set to true. With streaming set at “true”, the mySound.start() feature doesn’t work.

Cheers!  
Kirupa :rambo:

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 24, 2003, 3:56am UTC](https://forum.kirupa.com/t/song-position-reset/7516/9 "2003-05-24T03:56:39Z")

</div>

🙂 Glad everything worked out for ya.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 24, 2003, 7:25am UTC](https://forum.kirupa.com/t/song-position-reset/7516/10 "2003-05-24T07:25:24Z")

</div>

> \*Originally posted by waffe \*  
> \*\*mySound = new Sound();  
> mySound.loadSound(“music.mp3”,true);

Or

mySound = new Sound();  
mySound.attachSound(“mySound01”);

With the attachsound code I can also use this code  
mySound.start(0,999);

Which tells flash to start the song at 0 and loop forever.

How can I do this same concept with loadSound?  
😏 \*\*

on(release){  
if(playing!=true){  
x.loadSound(“na.mp3”,true);  
x.start(0,999);  
playing = true;  
}  
}
