Return to Snippet

Revision: 16444
at August 4, 2009 12:02 by Winkyboy


Initial Code
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

Initial URL
http://files.getdropbox.com/u/316550/code-AS2_debugg.zip

Initial Description
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.

Initial Title
AS2 debugging script

Initial Tags
debug

Initial Language
ActionScript