Aaron Haines wrote:

I want this class to exist independently of any onRelease functions which
have been assigned directly to movieclip instances.

i.e. I don't want to have to include a call to my class in the onRelease
function of every movieclip instance - I just want my class to listen for
any onRelease events, and then do some action depending on which clip was
clicked.

The idea is that I could then include this class in movies which have
already been created without having to go back through and add a call to my
class into every button and movieclip onRelease function.

On www.mosessupposes.com I have found this CallbackDispatcher.
Link to the Class: http://www.mosessupposes.com/2005/CallbackDispatcher.zip

Here's a example how it works:

CallbackDispatcher.initialize(my_mc);

my_mc.addEventListener ('onRollOver', this);
function onRollOver(o:Object) {
    trace('rollover for '+o.target+' captured in scope: '+this);
}



Here's the copied text of the entry:

Often when I'm writing classes if there is some simple clip that I'm only using callbacks from, like onPress, I end up writing references and callback functions onto it, which is kinda tacky.

Use this class like EventDispatcher to be able to addEventListener on any built-in callback. Works with MCs, TextFields, and Buttons, and includes multiple-simultaneous add/remove methods. Examples included!


Hope that helps.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to