最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - FlashAS3: ExternalInterface.call() "Why u no console.log?" - Stack Overflow

programmeradmin3浏览0评论

I'm trying to do a very simple test to get the AS3 ExternalInterface.call() to Javascript console.log() for me.

I have a simple SWF with AS3 on a top layer and a button that triggers the call.

import flash.external.ExternalInterface;

function log(message:String):void
{
    trace (message);
    if (ExternalInterface.available)
    {
        ExternalInterface.call('console.log', message);
    }
}

button.addEventListener(MouseEvent.CLICK,button_click);

function button_click(e:MouseEvent):void
{
    log("Hello World");
}

I have tested this in the Flash IDE to make sure the button click is tracing and it is. I've been testing this in both the latest Chrome and Firefox browser.

Am I doing something fundamentally wrong?

I'm trying to do a very simple test to get the AS3 ExternalInterface.call() to Javascript console.log() for me.

I have a simple SWF with AS3 on a top layer and a button that triggers the call.

import flash.external.ExternalInterface;

function log(message:String):void
{
    trace (message);
    if (ExternalInterface.available)
    {
        ExternalInterface.call('console.log', message);
    }
}

button.addEventListener(MouseEvent.CLICK,button_click);

function button_click(e:MouseEvent):void
{
    log("Hello World");
}

I have tested this in the Flash IDE to make sure the button click is tracing and it is. I've been testing this in both the latest Chrome and Firefox browser.

Am I doing something fundamentally wrong?

Share Improve this question asked Jul 14, 2011 at 16:20 user463112user463112
Add a ment  | 

1 Answer 1

Reset to default 3

tried the same! works for me. Make sure your addEventListener code inside a function like creation plete. it should be.

Also look at http://code.google./p/flash-thunderbolt/

发布评论

评论列表(0)

  1. 暂无评论