Posted By

Winkyboy on 08/04/09


Tagged

debug trace as2


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

yeco


AS2 debugging script


 / Published in: ActionScript
 

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

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.

  1. debugg("testing");
  2.  
  3.  
  4. //**************************** BEGIN DEBUG FUNCTION
  5. function debugg(whichText:String)
  6. {
  7. debug_txt.text += "\n\n" + whichText;
  8. trace("\n\n" + whichText + "\n\n");
  9. }
  10.  
  11. onEnterFrame = function() {
  12. if ((Key.isDown(Key.BACKSPACE))) {
  13. if ((Key.isDown(Key.LEFT))) {
  14. if (Key.getCode() == 17) { // so, press BACKSPACE+LEFT, and CONTROL (in that order, together) to reveal the debug
  15. debug_txt._y = Stage.height / 2;
  16. }
  17. }
  18. }
  19. };
  20. //**************************** END DEBUG FUNCTION

Report this snippet  

You need to login to post a comment.