Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:49:59+00:00 2026-06-07T07:49:59+00:00

How can you make an EventDispatcher extended class’s addEventListener visible to javascript by the

  • 0

How can you make an EventDispatcher extended class’s “addEventListener” visible to javascript by the mean of ExternalInterface, and how to make it work with javascript functions in order to call js functions when events happen in the flash object?

Is it event possible? Or it may require a number of tricks to make it work? The idea is to make it natural, as in just calling the addeventlistener in javascript, and the flash call the javascript callback when an internal event has ocurred?

Ex:

JAVASCRIPT:

flashobj.addEventListener("progress", function (event){alert(event.data);});

Flash:

ExternalInterface.addCallback("addEventListener_", addEventListener);
// as flashObj is a DOM interface after all, I have my reserve in using "addEventListener" as the name for the callback.
... // later in that code:
dispatchEvent(new Event("progress"));
// or
dispatchEvent(new JSEvent("progress"));

The result will be obviously a call to the js function that will alert event.data anything that will be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:50:00+00:00Added an answer on June 7, 2026 at 7:50 am

    You cannot pass a javascript function to flash like that.

    You can accept listeners in your javascript and fire those from flash though.

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

    Javascript:

    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(){
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make my javascript client application receive socket requests? I mean not
I can make infinite calling by returning $this in class body functions after creating
I can make a new , and that seems to work. But edit/update does
How i can make in this JS to display only once same class? In
I can make it work this way Dir.chdir(basedir) puts Dir.glob(#{filename}*).inspect Is there any way
We can make all elements of class 'button' as JQuery UI Buttons using the
We can make Webservice call in android app by creating HttpURLConnection and POST request.
I can make this code work without an object as input parameter for the
I can make abstract class equivalent to interface by putting all abstract methods within
I can make my program write a .dat file with an array of Node

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.