最初はブラクラなんてつくる気無かったんですが。

今度ExternalInterfaceを使って最大kBオーダーのテキストをjavascript→Flashに渡すようなアプリをつくるかもしれなくて、
ExternalInterface.addCallbackの限界を試したかったんです。

その結果は、IE7、FF2ともに 33,554,432[Byte]まではokだった。
その2倍はNG。IE7,FF2ともにメモリが不足しています、っていってjsがエラーる。

へー。

そしたらExternalInterface.callでFlash→javascriptにどんだけ渡せるのか試したくなる。

16,777,216[Byte]まではok。その2倍はIE7,FF2ともにNG。Flash側でメモリが足りなくなるようで、
IE7,FF2ともに終了。

へーへー。

Opera9.*,Safari3(Windows)も死亡
macは試してない

しかし、意外とたくさん送れるもんだなぁ。

検証コードはこんな

actionscript3

package {
    import flash.display.Sprite;
    import flash.system.Security;
    import flash.external.ExternalInterface;
    import flash.utils.setTimeout;
    public class RPCClient extends Sprite{
        private var debug :Boolean = true;
        Security.allowDomain('*');

        public function RPCClient(){
            ExternalInterface.addCallback("xi_send", xi_send);
            var message :String = "a";
            setTimeout( function() :void {
                message = message + message;
                ExternalInterface.call("show_length_of('"+message+"')");
                setTimeout( arguments.callee, 50 );
            }, 50 );
        }

        private function xi_send( st :String ) :void {
            logger("[xi_send]len: "+st.length);
        }

        private function logger(... args):void{
            if(!debug){ return; }
            log.apply(null,(new Array("[RPCClient]",this)).concat(args)); // to firebug
            //ExternalInterface.call("alert('"+args+"')");
        }
    }
}

javascript
require prototype.js

RPC = new function() {
    var clientid = "externalRPCClient";
    return {
        client : null,
        init : function() {
            var so = new SWFObject( '/swf/RPCClient.swf', clientid, 1, 1, "9", "#FFFFFF" );
            so.addParam("allowScriptAccess", "always");
            so.addParam("align", "middle");
            so.addParam("wmode","transparent");
            so.addVariable( "key", "whatever" );
            so.write( "rpc_container" );
        },
        start : function() {
            this.client = navigator.userAgent.match(/MSIE/) ? window[clientid] : document[clientid];
            if ( !this.client || typeof(this.client.xi_send)!="function" ) {
                console.log("[start]not ready");
                return;
            }
            var sending_message = "a";
            new (function() {
                sending_message = sending_message + sending_message;
                this.client.xi_send( sending_message );
                setTimeout( arguments.callee.bind(this), 50 );
            }.bind(this));
        }
    };
}
document.observe("dom:loaded", RPC.init.bind(RPC));

function show_length_of( message ) {
    alert("[show_length_of]"+message.length);
    //console.log("[show_length_of]"+message.length);
}

デモ
※注意。ブラウザが強制終了します

http://maaash.jp/lab/crasher/