Created
January 4, 2013 07:41
-
-
Save IQAndreas/4450713 to your computer and use it in GitHub Desktop.
Log data to both JavaScript and ActionScript (useful for switching between testing in the IDE and testing on the server)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import flash.external.ExternalInterface; | |
/** Will send the text to trace and JavaScript console (if available) | |
* Only to be used for debugging. Not to be used for final release! */ | |
public function log(... args):String | |
{ | |
// Log a blank line if nothing is passed | |
var str:String = (args.length > 0) ? args.join(" ") : "-----------------------------------"; | |
// JavaScript log (use something like FireBug to see the output) | |
if (ExternalInterface.available) | |
{ ExternalInterface.call("console.log", str); } | |
// ActionScript log | |
trace(str); | |
return str; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment