javascript 中使用 addEventListener 监听 flash 事件

var flash = {

    types: {

    },

    event: function( type ) {
        var listeners = this.types[type];

        if( listeners ) {
            for( var i = 0; i < listeners.length; ++i ) {
                listeners[i]();
            }
        }
    },

    addEventListener: function( type, fn ) {
        if( !this.types[type] ) {
            this.types[type] = [];
        }

        this.types[type].push(fn);
    }

};

flash.addEventListener( "progress", function(){

});

 

ExternalInterface.call( "flash.event", "progress");
ExternalInterface.call( "flash.event", "loaded");
//Etc

 

posted @ 2012-08-20 14:29  noyobo  阅读(718)  评论(0编辑  收藏  举报