Skip to content

Instantly share code, notes, and snippets.

@IQAndreas
Created May 5, 2013 02:23
Show Gist options
  • Save IQAndreas/5519431 to your computer and use it in GitHub Desktop.
Save IQAndreas/5519431 to your computer and use it in GitHub Desktop.
Log flash data both to `trace` and the JavaScript console.
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:*) : void
{
//Nothing to log
if (args.length <= 0) { return; }
for (var i:uint = 0; i < args.length; i++)
{
if (ExternalInterface.available)
{ ExternalInterface.call("console.log", args[i]); }
}
//Join strings instead?
trace(args.join(" "));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment