var flexapp;
var flexfunc;
var flexu;

var initFlashCallback = function() {
	flexapp = FABridge.flashURLLoader.root();
	if (flexu != null) {
		loadFlashURL(flexu, flexfunc);
	}
}

// register the callback to our Flex application with the 'bridgeName' of 'flashURLLoader'
FABridge.addInitializationCallback( "flashURLLoader", initFlashCallback );

function onData(data) {
	try {
		flexfunc(data);
		//eval('(' + data + ')')
	}
	catch (e){
		// Try this for data that is not js/json. i.e. html.
		// Maybe a better fix for this?
		//flexfunc(data);
	}
}

function loadFlashURL(url, fun) {
	flexfunc = fun;
	flexu = url;
	if (flexapp != null) {
		flexapp.loadURL(url);
	}
}








