/ Published in: ActionScript
This can be used instead of "trace" to populate a text field in addition to the standard trace output. The textfield stays hidden until a selected key combination is pressed, thus allowing you to use it in a staging or, if need be, a production environment while keeping it hidden.
Obviously it would be best to remove it from production when it debugging is finally complete, and you should change the key combination to something of your own making.
Obviously it would be best to remove it from production when it debugging is finally complete, and you should change the key combination to something of your own making.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
debugg("testing"); //**************************** BEGIN DEBUG FUNCTION function debugg(whichText:String) { debug_txt.text += "\n\n" + whichText; trace("\n\n" + whichText + "\n\n"); } onEnterFrame = function() { if ((Key.isDown(Key.BACKSPACE))) { if ((Key.isDown(Key.LEFT))) { if (Key.getCode() == 17) { // so, press BACKSPACE+LEFT, and CONTROL (in that order, together) to reveal the debug debug_txt._y = Stage.height / 2; } } } }; //**************************** END DEBUG FUNCTION
URL: http://files.getdropbox.com/u/316550/code-AS2_debugg.zip