Use this script to overwrite all onStatus function prototypes. By including this script template, you will not be required to define any onStatus events. This is an excellent tool for debugging.
function onStatusTemplate(info) { infoMessage_array = info.code.split("."); trace(" ** Status Message Received for: "+infoMessage_array[0]+" **"); trace(" ** "+new Date()); trace(" |::: Level?> "+info.level); trace(" |::: Code ?> "+info.code); // Trace extra Information properties if (info.description != undefined) { trace(" |::: Description?> "+info.description); } if (info.details != undefined) { trace(" |::: Details?> "+info.details); } if (info.application != undefined) { trace(" |::: Application?> "+info.application); } switch (infoMessage_array[0]) { case "Application" : trace(" | ::::Application Messages"); // Display Script Error Messages if (infoMessage_array[1] == "script") { trace(" |::: Script Error Details. Filename?> "+info.filename+" Line?> "+info.lineno); trace(info.linebuf); } // Place Code Here break; case "Camera" : // | :::: Handle Camera Messages // Place Code Here break; case "Microphone" : // | :::: Handle Microphone Messages // Place Code Here break; case "NetConnection" : // | ::: Handle NetConnection Messages if (infoMessage_array[2] == "Success") { trace(" |::* Connection was Accepted by the Server , continuing to load!"); // Scripts to run when the Connection has succeeded nc.call("sayHelloServer", new server_ret()); nc.call("setConnectTimes", new server_ret()); connectObjects(); streamIt(); } // Place Code Here break; case "NetStream" : // | :::: Handle NetStream Messages // Place Code Here } trace(" ** End Status Message for: "+infoMessage_array[0]+" **"); trace(""); }
Listings E.6 and E.7 will assign this template to the object onStatus prototypes on the Client and in SSAS.
Use the ActionScript in Listing E.6 in Flash to use the onStatus template in Listing E.5 to overwrite the object prototypes. Trace actions will appear in the Flash Output window, when testing your Flash movie in Flash MX.
// Client Side Objects Camera.prototype.onStatus = onStatusTemplate; Microphone.prototype.onStatus = onStatusTemplate; NetConnection.prototype.onStatus = onStatusTemplate; NetStream.prototype.onStatus = onStatusTemplate; SharedObject.prototype.onStatus = onStatusTemplate;
Use the ActionScript in Listing E.7 in SSAS to use the onStatus template in Listing E.5 to overwrite the object prototypes. Remember, the ActionScript in Listing E.5 must be added or loaded into the main.asc file for this to work. Trace actions will appear in the App Inspector or the NetConnection Debugger.
/* main.asc file */ // Server Side Objects Application.prototype.onStatus = onStatusTemplate; Stream.prototype.onStatus = onStatusTemplate; SharedObject.prototype.onStatus = onStatusTemplate;