Loading Music
#1
Posted 22 June 2007 - 08:25 AM
#2
Posted 22 June 2007 - 08:28 AM
#3
Posted 27 June 2007 - 04:59 PM
#4
Posted 27 June 2007 - 05:46 PM
Edited by Pax, 27 June 2007 - 05:46 PM.
#5
Posted 27 June 2007 - 07:41 PM
file = "uploads/mp3_music/"+file_to_play;
MySound = new Sound();
MySound.loadSound(file, false);
_root.stat_bar.progress_mc._xscale = 0;
playin = false;
loaded = true;
step = 0;
pauses = false;
moving = false;
off = 0;
onEnterFrame = function () {
percent = (MySound.getBytesLoaded()/MySound.getBytesTotal())*100;
_root.stat_bar.progress_mc._xscale = percent;
if (percent == 100 && playin == false && loaded == true) {
MySound.start(0, 1);
playin = true;
loaded = false;
}
music_length = MySound.duration/1000;
music_pos = MySound.position/1000;
music_bar_len = _root.stat_bar.progress_mc._width;
bar_percent = (music_pos/music_length)*100;
if (moving == false) {
_root.stat_bar.arrows._x = bar_percent*(music_bar_len/100);
}
if (pauses == false) {
step = music_pos;
}
minutes = Math.floor(MySound.position/1000/60);
seconds = Math.floor(MySound.position/1000)%60;
band_song = author;
if (title_song == undefined || title_song == "") {
title_song = "Unknown Title";
}
if (band_song == undefined || band_song == "") {
band_song = "Unknown Artist";
}
if (seconds<10) {
seconds = "0"+seconds;
}
if (minutes<10) {
minutes = "0"+minutes;
}
_root.display_txt.text = title_song+" / "+band_song+" "+minutes+":"+seconds;
if (percent<100) {
_root.stat_bar.arrows.enabled = false;
_root.volume_bar.dragger.enabled = false;
pausebtn.enabled = false;
playbtn.enabled = false;
stopbtn.enabled = false;
_root.stat_bar.arrows._alpha = 50;
_root.volume_bar.dragger._alpha = 50;
pausebtn._alpha = 50;
playbtn._alpha = 50;
stopbtn._alpha = 50;
} else {
_root.stat_bar.arrows.enabled = true;
_root.volume_bar.dragger.enabled = true;
pausebtn.enabled = true;
playbtn.enabled = true;
stopbtn.enabled = true;
_root.volume_bar.dragger._alpha = 100;
_root.stat_bar.arrows._alpha = 100;
pausebtn._alpha = 100;
playbtn._alpha = 100;
stopbtn._alpha = 100;
}
if (moving == true) {
off = (_root.stat_bar.arrows._x/_root.stat_bar.progress_mc._width)*music_length;
}
};
_root.volume_bar.dragger.onPress = function() {
startDrag(this, true, 0, this._y, _root.volume_bar.main._width, this._y);
this.onEnterFrame = function() {
var p = (this._x/_root.volume_bar.main._width)*100;
MySound.setVolume(p);
};
};
_root.volume_bar.dragger.onRelease = function() {
stopDrag();
};
_root.volume_bar.dragger.onReleaseOutside = function() {
stopDrag();
};
_root.stat_bar.arrows.onPress = function() {
MySound.stop();
startDrag(this, true, 0, this._y, _root.stat_bar.progress_mc._width, this._y);
moving = true;
};
_root.stat_bar.arrows.onRelease = function() {
stopDrag();
MySound.start(off, 0);
moving = false;
};
_root.stat_bar.arrows.onReleaseOutside = function() {
stopDrag();
moving = false;
MySound.start(off, 0);
};
playbtn.onPress = function() {
if (playin == false) {
MySound.start(step, 1);
playin = true;
pauses = false;
}
};
pausebtn.onPress = function() {
if (playin == true) {
MySound.stop();
playin = false;
pauses = true;
}
};
stopbtn.onPress = function() {
if (playin == true) {
MySound.stop();
playin = false;
pauses = true;
step = 0;
}
};
#6
Posted 27 June 2007 - 09:23 PM
MySound = new Sound(this);
Try using that. It passes an object into the Sound Object to attach to. This can cause problems with playback. Do you have the mp3 player live yet? Might want to try adding a listenener to the loading of the sound object so you can make sure it loads properly.
#7
Posted 28 June 2007 - 02:10 PM
Edited by Hip Hop Artist, 28 June 2007 - 02:11 PM.
#8
Posted 28 June 2007 - 04:59 PM
What part of Windsor are you in? How are your flash/graphic skills? The company I work for may be hiring right now if you've got some skill. http://www.mcgill.com
Edited by Pax, 28 June 2007 - 05:01 PM.
#9
Posted 28 June 2007 - 06:13 PM
#10
Posted 28 June 2007 - 08:59 PM
#11
Posted 28 June 2007 - 09:13 PM
#12
Posted 28 June 2007 - 09:30 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
