
November 4th, 2003, 07:55 AM
|
|
Contributing User
|
|
Join Date: Aug 2003
Posts: 47
Time spent in forums: 3 h 28 m 45 sec
Reputation Power: 6
|
|
|
dynamic jukebox
Hey Guys,
Im building and online jukebox that loads mp3 dynamically from the server. its set in this website. as you can see im having trouble preloading the sounds properly. You can see on an initial click the sound dosnt seem to preload proplery. after a few clicks things start to work.
the jukbox works fine if the sounds are streamed, but i need them to preload, not stream. heres the code that handles the sounds. its placed on the first frame of a single framed movie clip.
Code:
this.onLoad = function() {
soundLoading = 0;
};
this.onEnterFrame = function() {
soundTotal = eval(curPath).getBytesTotal();
soundLoaded = eval(curPath).getBytesLoaded();
if (preloadNow == 1 && soundLoaded == 0) {
_root.percentLoadedText = "loading track 0%";
}
if (preloadNow == 1 && soundLoaded>0) {
soundLoading = Math.round((soundLoaded/soundTotal)*100);
if (soundLoading == 100) {
preloadNow = 0;
eval(curPath).start("0","9999");
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "loading track "+soundLoading+"%";
}
}
};
_parent.button1.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop1") {
_root.percentLoadedText = "funk hip hop";
}
};
_parent.button1.onRelease = function() {
eval(curPath).stop();
curLoop = "funk hip hop";
curPath = "_parent._parent.loop1";
_root.rootCurLoop = "loop1";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop1.loadSound("../sounds/loop1.mp3", false);
preloadNow = 1;
}
};
_parent.button1.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
_parent.button2.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop2") {
_root.percentLoadedText = "hip hop";
}
};
_parent.button2.onRelease = function() {
eval(curPath).stop();
curLoop = "hip hop";
curPath = "_parent._parent.loop2";
_root.rootCurLoop = "loop2";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop2.loadSound("../sounds/loop2.mp3", false);
preloadNow = 1;
}
};
_parent.button2.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
_parent.button3.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop3") {
_root.percentLoadedText = "r & b";
}
};
_parent.button3.onRelease = function() {
eval(curPath).stop();
curLoop = "r & b";
curPath = "_parent._parent.loop3";
_root.rootCurLoop = "loop3";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop3.loadSound("../sounds/loop3.mp3", false);
preloadNow = 1;
}
};
_parent.button3.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
_parent.button4.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop1") {
_root.percentLoadedText = "reggae";
}
};
_parent.button4.onRelease = function() {
eval(curPath).stop();
curLoop = "reggae";
curPath = "_parent._parent.loop4";
_root.rootCurLoop = "loop4";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop4.loadSound("../sounds/loop4.mp3", false);
preloadNow = 1;
}
};
_parent.button4.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
_parent.button5.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop1") {
_root.percentLoadedText = "reggae 2";
}
};
_parent.button5.onRelease = function() {
eval(curPath).stop();
curLoop = "reggae 2";
curPath = "_parent._parent.loop5";
_root.rootCurLoop = "loop5";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop5.loadSound("../sounds/loop5.mp3", false);
preloadNow = 1;
}
};
_parent.button5.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
_parent.button6.onRollOver = function() {
if (preloadNow != 1 && _root.rootCurLoop != "loop1") {
_root.percentLoadedText = "hip hop";
}
};
_parent.button6.onRelease = function() {
eval(curPath).stop();
curLoop = "hip hop";
curPath = "_parent._parent.loop6";
_root.rootCurLoop = "loop6";
if (playing != curPath) {
playing = curPath;
_parent._parent.loop6.loadSound("../sounds/loop6.mp3", false);
preloadNow = 1;
}
};
_parent.button6.onRollOut = function() {
if (soundLoading == 100) {
_root.percentLoadedText = "playing "+curLoop;
} else {
_root.percentLoadedText = "Select your music";
}
};
stop();
any help would be great, its really got me stumped!
thanks
mish
|