﻿// JScript File

function handleFlashCallbackEvent(obj,event){
	extraArgs = [];	
	for(var i=2; i<arguments.length; i++) {
		extraArgs.push(arguments[i]);
	}
	this["FLO_"+obj][event].executeCallBacks(extraArgs);
}

OnCallBack = function(functionName){
	this.fn=functionName;
	return this;
}

CallbackObject = function(){
	this.callbackObjects = new Array();
}

CallbackObject.prototype.addCallbackFunction = function(obj){
	if(obj.fn != null) {
		this.callbackObjects.push(obj);
	} else {
		alert("callbackObjects: obj.fn == null");
	}
}

CallbackObject.prototype.executeCallBacks = function(args){
	for(j=0;j<this.callbackObjects.length;j++) {
		this.callbackObjects[j].fn(args);
	}
}

FlashListenerObject = function(id){
	this.callbackObjects = {};
	this.id = id;
}

FlashListenerObject.prototype.registerEvent = function(event_name){
	this[event_name] = new CallbackObject();	
}


