PDA

View Full Version : good ref given


oldarney
10-28-2005, 11:03 PM
im making a small juke box with a streaming mp3 for a site and well it just wont work i think its some sort of mistake i made but it should be easy. to fix well not easy enough for me to fix


//selection box parameters
//default music
if (selection_box._currentframe == 1) {
url = "music/benny benassi i love my sex.mp3";
}
if (selection_box._currentframe == 5) {
url = "music/benny benassi i love my sex.mp3";
}
if (selection_box._currentframe == 10) {
url = "music/benny benassy satisfaction.mp3";
}
// create sound object, assign events
function createSoundObject() {
soundContainer = new Sound(this);
// define sound object
soundContainer.onSoundComplete = updateStatus;
// change state at song end
return;
}
// create initial sound object
createSoundObject();
prevUrl = null;
// store current url in global variable
isPlaying = false;
// store playstate in global variable
// load and/or play sound
function playSnd(url) {
// check playstate
if (isPlaying) {
return;
// deactivate button during play/load
} else {
isPlaying = true;
}
// check if same or new sound
if (prevUrl != url) {
// new sound
soundContainer.loadSound(url, true);
// sound automatically plays after loading
prevUrl = url;
} else if (soundContainer.position>(soundContainer.duration-100)) {
// same sound
soundContainer.start(0);
// replay from beginning
} else {
// same sound
soundContainer.start(soundContainer.position/1000);
// start sound at last paused
}
onEnterFrame = showPlayState;
// start tracking playstate
}
// stop both playback and download
function stopSnd() {
soundContainer.stop();
// stop playback
delete soundContainer;
// stop download
createSoundObject();
// create a new sound object
isPlaying = false;
prevUrl = "";
// clear for next load
onEnterFrame = null;
// stop tracking playstate
status = "stopped";
}
// store state and show status at end of song
function updateStatus() {
isPlaying = false;
onEnterFrame = null;
// stop tracking playstate
status = "complete";
}
// show playback and load status
function showPlayState() {
// use Number function to convert undefined values to 0
var sndPos = Number(soundContainer.position);
var loaded = (Number(soundContainer.getBytesTotal()>0) && Number(soundContainer.getBytesLoaded()) == Number(soundContainer.getBytesTotal()));
if (sndPos<=prevPos && !loaded) {
// loading
status = "loading";
} else {
// playing
status = "playing";
}
prevPos = sndPos;
// store for next loop
}
prevPos = 0;
// store last position in global variable
// store state and show status at end of song
function updateStatus() {
isPlaying = false;
onEnterFrame = null;
// stop tracking playstate
status = "complete";
}
// pause sound
function pauseSnd() {
soundContainer.stop();
isPlaying = false;
onEnterFrame = null;
// stop tracking playstate
status = "paused";
}
// stop sound reset position to begining
function rewindSnd() {
soundContainer.stop();
// stop current playback
soundContainer.start(0);
// reset position to 0
soundContainer.stop();
// prevent imediate playback
isPlaying = false;
onEnterFrame = null;
// stop tracking playstate
status = "rewound";
}
// assign button events
play_Btn.onRelease = function() {
playSnd(url);
};
stop_Btn.onRelease = stopSnd;
pauseBtn.onRelease = pauseSnd;
rewindBtn.onRelease = rewindSnd;


if you hapend to have a computer with out one single song to test the script
here is one of my favs
http://www6.rapidupload.com/download.php?file=dl&filepath=138

here is the web site im doing
my page (http://promocionelectro.50megs.com/)

oldarney
10-29-2005, 02:57 AM
for those of you wondering. i still havent finished!!!! help!!!!!:eek:

oldarney
10-29-2005, 01:45 PM
here is the updated fla i dont know why dosent it work
http://www2.rapidupload.com/download.php?file=dl&filepath=238

oldarney
10-29-2005, 04:07 PM
omg...some one please answer tell me what you need to know in order to solve this cus i cant or at leaset tell me im not that good to solve this.

amen0
10-29-2005, 04:34 PM
hi, the first thing is
flash is case Sensetive so
play_btn.onRelease = function() {
playSnd(url);
};
and for the other stop and rewind
and another thing
when the user choose a song the url value must change so you can't chang it by

if (selection_box._currentframe == 1) {
url = "music/benny benassi i love my sex.mp3";
}
if (selection_box._currentframe == 5) {
url = "music/benny benassi i love my sex.mp3";
}
if (selection_box._currentframe == 10) {
url = "music/benny benassy satisfaction.mp3";
}

the solution is to put in each clickable song name Movie clip

on(realease){
gotoAndStop(--)
url=....//change the value here
}

oldarney
10-29-2005, 04:55 PM
omg god i cant thank you enough im literaly crying right now it work!!!!!
finallly thank you thank you thank you if there is anything i could do for you pm me