How would I call this javascript function and recieve the error code back if any.
[AS]
import flash.external.ExternalInterface;
ExternalInterface.call(“SCOInitialize”, My_error );
function My_error(err:String )
{
mytext_txt.text = err;
}
[/AS]
My java script function
function SCOInitialize() {
var err = true;
if (!g_bInitDone) {
if ((window.parent) && (window.parent != window)){
g_objAPI = FindAPI(window.parent)
}
if ((g_objAPI == null) && (window.opener != null)) {
g_objAPI = FindAPI(window.opener)
}
if (!APIOK()) {
AlertUserOfAPIError(g_strAPINotFound);
err = false
} else {
err = g_objAPI.LMSInitialize("");
if (err == "true") {
g_bSCOBrowse = (g_objAPI.LMSGetValue("cmi.core.lesson_mode") == "browse"); if (!g_bSCOBrowse) {
if (g_objAPI.LMSGetValue("cmi.core.lesson_status") == "not attempted") {
err = g_objAPI.LMSSetValue("cmi.core.lesson_status","incomplete")
}
}
} else {
AlertUserOfAPIError(g_strAPIInitFailed)
}
}
if (typeof(SCOInitData) != "undefined") {
// The SCOInitData function can be defined in another script of the SCO
SCOInitData()
}
g_dtmInitialized = new Date();
}
g_bInitDone = true;
[COLOR="red"]return (err + "") [/COLOR]// Force type to string
}