Forum Topic: External MP3, Infinite loop?

(134 views • 4 replies)

This topic is 1 page long.

<< < > >>
Resigned

SecretSecretary

Reply To Post Reply & Quote

Posted at: 5/22/08 10:53 AM

SecretSecretary DARK LEVEL 21

Sign-Up: 03/19/06

Posts: 22

Hi there! I've been browsing here for a few hours and I cant find any way to do an infinite loop with the external songs I am loading into my flash. My code goes as follows (Its in a frame, not a movieclip):

song = new Sound (soundLoader);
song.loadSound("songs/JourneyWithin.mp3"
, true);
stop();

It works perfectly well, but I would like it to loop eternally. The next code I found in a post by EQFlash seemed particularly promising, but it failed to work. I think it might be because of the onEnterFrame code, because my frame is ordered to stop, but then again, if I dont stop my frame it will just continue to the next frame where it will load up my next song. Aaargh! Anyway, here's the code Im talking about:

song = new Sound();
song.loadSound("your.mp3", true);
onEnterFrame = function () {
pos = song.position/1000;
dur = song.duration/1000;
if (pos>=dur) {
song.start();
}
};

Does anybody have any idea how I can just simply load an external mp3
into my .swf and make it loop infinitely? Not from the source file or from
the library or wherever, but from a completely different location. I load
the song up from a folder on my website. The swf is also on my website,
that's why there's no complicated url in the code.

I hope somebody can shine light on this.

-Secret


Sad

SecretSecretary

Reply To Post Reply & Quote

Posted at: 5/22/08 11:01 AM

SecretSecretary DARK LEVEL 21

Sign-Up: 03/19/06

Posts: 22

Actually I've been browsing for an answer on flashkit, and I posted this on there as well.
I though I might try my luck here :)


None

gankro

Reply To Post Reply & Quote

Posted at: 5/22/08 12:31 PM

gankro EVIL LEVEL 11

Sign-Up: 09/16/06

Posts: 1,173

start(0, 99999999);

not necessarily infinite but close enough, no?

My Coding Portfolio (updated frequently)
If you stay in bed for long enough it will be socially acceptable to go to bed again

BBS Signature

Misunderstood

SeethingSwarm

Reply To Post Reply & Quote

Posted at: 5/23/08 06:12 AM

SeethingSwarm DARK LEVEL 21

Sign-Up: 03/08/08

Posts: 23

I've tried that, it doesnt work


None

GuyWithHisComp

Reply To Post Reply & Quote

Posted at: 5/23/08 06:28 AM

GuyWithHisComp LIGHT LEVEL 27

Sign-Up: 11/10/05

Posts: 4,008

Using onSoundComplete, you'd get something like this:

var mySong:Sound = new Sound();
mySong.loadSound("your.mp3", true);
mySong.onSoundComplete = function() {
	mySong.start();
};
mySong.start();
BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 12:34 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!