Hey folks,

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.  Can I do it simply like this, or do I need to
create a separate class for the button MovieClips?

       //THIS IS THE PART THAT'S NOT WORKING
        english.onRelease = french.onRelease = german.onRelease =
spanish.onRelease =
            addEventListener(this, languageClicked);

Thanks in advance for any help!

-steve

import mx.utils.Delegate;
import mx.events.EventDispatcher;
import com.mosesSupposes.fuse.Fuse;
import com.mosesSupposes.fuse.ZigoEngine;
import com.myClient.Element;
import com.myClient.Language;

class LanguageChooser extends Element
{
    //movieclip children
    private var english:MovieClip;
    private var french:MovieClip;
    private var german:MovieClip;
    private var spanish:MovieClip;

    public var addEventListener:Function;
    public var removeEventListener:Function;
    public var dispatchEvent:Function

    public function LanguageChooser()
    {
        super();
        position();
        setup();
        transitionIn();
    }

    private function setup(Void) : Void
    {
       //THIS IS THE PART THAT'S NOT WORKING
        english.onRelease = french.onRelease = german.onRelease =
spanish.onRelease =
            addEventListener(this, languageClicked);

        english.onRollOver = french.onRollOver = german.onRollOver =
spanish.onRollOver =
            function() {ZigoEngine.removeTween(this); ZigoEngine.doTween(this,
"_y", -4, 0.08, "linear");};
        english.onRollOut = french.onRollOut = german.onRollOut =
spanish.onRollOut =
        english.onReleaseOutside = french.onReleaseOutside =
german.onReleaseOutside = spanish.onReleaseOutside =
            function() {ZigoEngine.removeTween(this); ZigoEngine.doTween(this,
"_y", 0, 0.5, "easeOutCubic");};
    }

    private function languageClicked(eventObj:Object){
        trace(eventObj.target + ": " + eventObj.type);
        Language.setLanguage(eventObj._name);
    }
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to