Steve -

Yes there are 2 things available for this. MM added that functionality in some event classes that are pretty much undocumented and a little tough to learn - UIEventDispatcher and LowLevelEvents.

Secondly, I wrote a class called CallbackDispatcher that makes it really easy to use events to scope simple callbacks wherever you want. It's available free at my website and includes a comparison & example of the MM system.

You can specify an event prefix like "evt_" then name your events like "evt_onRollOver", or use Delegates as shown here, to route any built-in MC, Button, or TextField callbacks to a uniquely named method. This really helps keep scoping mouse events tidy and also gives you an opportunity to group the events for some subset of nav elements into smartly named handlers, like "handleNavEvent" in this example which will do rollover/out and onpress actions - keeps your classes neat. (Again, the use of Delegate is entirely optional.)

var navDel:Function = Delegate.create(this, handleNavEvent);
CallbackDispatcher.initialize(mc);
mc.addEventListener ('onRollOver, onRollOut, onPress', navDel);

function handleNavEvent(o:Object) {
        trace(o.target._name+'.'+o.type);
        switch(o.type) {
                // etc..
        }
}

download at: http://www.mosessupposes.com/utilities/index.html

Hope that helps you out!
- Moses


On Jan 19, 2006, at 2:33 PM, Steve Warren wrote:

I'm having a little trouble getting addEventListener to work. I've tried a bunch of combinations, but have yet to find the right one. I'm trying to
assign onRelease functions to a bunch of buttons in my LanguageChooser
class. All I want to do is call a function inside LanguageChooser, telling
it which button was clicked.
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to