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.