Help with the EventDispatcher

Hey guys,

I have yet another question. This time about the event dispatcher. I have two files - player.fla and MP3Player.as (class file)

player.fla (first frame actions - there is nothing else in this fla =P)


var Player:MP3Player = new MP3Player();
Player.listen.onPlaylist = function(obj:Object){
	trace(obj);
}
Player.loadPlaylist("playlist.txt",true);

MP3Player.as


import mx.events.EventDispatcher;
class MP3Player{
	var playlist_file:String = "";
	var number_of_songs:Number = 0;
	var stream:Boolean = true;
	var Songs:Array = new Array();
	
	var createEvent:Function;
	var dispatchEvent:Function;
	var addEventListener:Function;
	var handleEvent:Function;
	var removeEventListener:Function;
	
	public var listen:Object = new Object;
	
	function MP3Player(){
		EventDispatcher.initialize(MP3Player.prototype);
		this.addEventListener("onPlaylist",listen);
	}
	
	function loadPlaylist(_playlist:String,_stream:Boolean){
					
		playlist_file = _playlist;
		stream = _stream;
		
		// load playlist
		var loadPlaylist:LoadVars = new LoadVars();
		loadPlaylist.onLoad = function(success){
			if(success){
				
				dispatchEvent({type:"onPlaylist", target:listen});
												
			}
		}
		loadPlaylist.load(playlist_file);
	}

}

Basically I am trying to set off an event when the playlist has loaded. It seems right to me, but apparently its not because the player.fla never traces “here”. Can anyone please help me with this ?

Thanks
Aditya

bump

someone? please? :crying: