
Welcome Guest
|
#1
|
|||
|
|||
|
mp3 player in external .swf
Hi guys. I have an mp3 player in an externally loaded .swf, I used a tutorial from: [http://www.pixel2life.com/publish/tu...r_using_xml_/] to create the mp3 player, which originally sat on the main timeline of my website. I have altered the script so that I can place the mp3 player in the external .swf and the music plays but the "loading" and song information text does not load. Does anyone have any ideas on what I need to change for these to work? heres the code for the text loading part:
Actionscript:
MovieClip.prototype.songStarter = function(file, name, band) {
if (this.sound_obj) {
this.sound_obj.stop();
delete this.sound_obj;
}
this.sound_obj = new Sound(this);
this.sound_obj.loadSound(file, true);
this.onEnterFrame = function() {
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text = name+" / "+band;
timeInterval = setInterval(timer, 1000, this.sound_obj);
} else {
this._parent.display_txt.text = "loading...";
}
};I have tried changing the path to _parent_parent but this didn't work. heres the full code: Actionscript:
stop();
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
if (success) {
_global.songname = [];
_global.songband = [];
_global.songfile = [];
for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname[i] = playlist.firstChild.childNodes[i].attributes.name;
_global.songband[i] = playlist.firstChild.childNodes[i].attributes.band;
_global.songfile[i] = playlist.firstChild.childNodes[i].attributes.file;
// trace(songname[i]+" "+songfile[i]+" "+songband[i]);
}
}
_parent.createEmptyMovieClip("sound_mc", 1);
_global.song_nr = random(songfile.length);
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
function timer(sound_obj) {
time = sound_obj.position/1000;
min = Math.floor(time/60);
min = (min<10) ? "0"+min : min;
sec = Math.floor(time%60);
sec = (sec<10) ? "0"+sec : sec;
timeDisplay_txt.text = min+":"+sec;
}
MovieClip.prototype.songStarter = function(file, name, band) {
if (this.sound_obj) {
this.sound_obj.stop();
delete this.sound_obj;
}
this.sound_obj = new Sound(this);
this.sound_obj.loadSound(file, true);
this.onEnterFrame = function() {
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.display_txt.text = name+" / "+band;
timeInterval = setInterval(timer, 1000, this.sound_obj);
} else {
this._parent.display_txt.text = "loading...";
}
};
this.sound_obj.onSoundComplete = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_parent._parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
this._parent._parent.volume1.dragger.onPress = function() {
startDrag(this, true, 0, this._y, this._parent._parent.volBG._width, this._y);
this.onEnterFrame = function() {
var p = (this._x/this._parent._parent.volBG._width)*100;
this._parent._parent._parent.sound_mc.sound_obj.se tVolume(p);
};
};
this._parent._parent.volume1.dragger.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
};
this._parent._parent.volume1.dragger.onReleaseOuts ide = function() {
stopDrag();
};
};
btn_play.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.songStarter(songfile [song_nr], songname[song_nr], songband[song_nr]);
};
btn_stop.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_ABOUT2.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_VISUALS.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_STORE2.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_NEWS2.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_CONTACT2.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_Guestbook.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
this._parent._parent.sound_mc.sound_obj.stop();
};
mc_Discogrpahy.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
mc_LYRICS.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
mc_FILM.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
mc_radio.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
mc_OTHER.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = "00:00";
this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
btn_rev.onRelease = function() {
clearInterval(timeInterval);
this._parent._parent.timeDisplay_txt.text = "00:00";
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
_parent.sound_mc.songStarter(songfile[song_nr], songname[song_nr], songband[song_nr]);
};
playlist.load("http://www.mysite.co.uk/mp3/playlist.xml");i hope someone can help me! ash |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The News From Adobe on the Future of Flash Platform | FlashMove | Chit Chat Lobby | 0 | 11-10-2011 09:55 AM |
| Hidden button with mp3 player - working too well! help! | 47rickym | Flash CS3 / Flash 9 |
0 | 02-02-2009 04:55 PM |
| Possible to load all external .swf files at once ? | Ultra | Flash CS3 / Flash 9 |
2 | 10-04-2007 11:56 AM |
| external .swf acting strange | mbodel | Flash MX |
4 | 05-22-2007 07:57 AM |
| Exciting new FLV / MP3 player... | pushstream | New Softwares | 0 | 06-21-2005 09:52 PM |

Programming Languages



