Skip to content

Instantly share code, notes, and snippets.

@kawanet
Last active January 4, 2016 04:49
Show Gist options
  • Save kawanet/8570653 to your computer and use it in GitHub Desktop.
Save kawanet/8570653 to your computer and use it in GitHub Desktop.
This calls "console.log()" method to show messages on web browser's JavaScript console from ActionScript.
/**
* @example
* Console.log("text", {"key":"value"}, ["array"]);
*/
package {
import flash.external.ExternalInterface;
public class Console {
public static function log(message : String, ...args) : void {
if (!ExternalInterface.available) return;
var func : String = "(console && console.log && console.log.bind(console) || (function(){}))";
args.unshift(func, message);
ExternalInterface.call.apply(null, args);
}
}
}
@kawanet
Copy link
Author

kawanet commented Jan 23, 2014

ActionScript からブラウザの JavaScript コンソールにメッセージを表示する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment