Hi all, I've a movie setup like this

main.fla

var control:MoveMe = new MoveMe(this, 10, 10);
var oViewListener:Object = new Object();
myMenu.addEventListener("mex", oViewListener);
oViewListener.mex = function(oEvent:Object):Void  {
    trace(oEvent.evsource);
    trace(oEvent.msgtxt);
};

and a class with this code

class MoveMe {
    function MoveMe(mc:MovieClip, myX:Number, myY:Number) {
        mc.attachMovie("mcStart", "myMenu", mc.getNextHighestDepth(),
{_x:myX, _y:myY});
    }
}

and a movieClip with this code in the first frame

**********************[mcStart]********************

this.useHandCursor = true;
mx.events.EventDispatcher.initialize(this);
function dispatchEvent() {
}
function addEventListener() {
}
function removeEventListener() {
}
onPress = function () {
    trace("funziona");
    sendMessage("prova");
};
onRollOver = function () {
};
onRollOut = function () {
};
function sendMessage(p_msgtxt:String):Void {
    var eventObj:Object = {target:this, type:"mex"};
    eventObj.evsource = this;
    eventObj.msgtxt = p_msgtxt;
    dispatchEvent(eventObj);
}

I read a lot about event dispatching and listening but there's still
something that I don't get.

What's wrong with my setup?
--
"When everyone is against you, it means that you are absolutely wrong-- or
absolutely right."
  - Albert Guinon
_______________________________________________
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