Last active
January 4, 2016 04:49
-
-
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.
This file contains 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
/** | |
* @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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ActionScript からブラウザの JavaScript コンソールにメッセージを表示する。