all groups > flash actionscript > september 2004 >
You're in the

flash actionscript

group:

Mouse Class - Listener Problems


Mouse Class - Listener Problems scisnero
9/8/2004 10:25:59 PM
flash actionscript:
hi Again, i have a new problem now. im ussing the mouse class, and adding
listeners. i have the next code:

objMouse = new Object()
objMouse.onMouseUp = mouseListener

function mouseListener () {
trace(this)
}

that trace return Object, when i really want to access to the movie clip that
hold the script. Please help me
Re: Mouse Class - Listener Problems blenz
9/8/2004 10:30:57 PM
Re: Mouse Class - Listener Problems scisnero
9/8/2004 10:38:52 PM
i?ve tried that and the answer was "undefined"

i have a class where i have that Mouse event. And it return the object
objMouse, when i need it tu return the movie clip, or class that holds it, to
acces to the data of the class.
Re: Mouse Class - Listener Problems _jrh_
9/8/2004 11:07:33 PM
You have to see if the movieclip was pressed, not the object. So instead you
use the following prototype assignment:

objMouse = new Object();
MovieClip.prototype.onMouseUp = function () {
if (this.hitTest(_root._xmouse,_root._ymouse,this)) {
trace(this._name);
}
}
Mouse.addListener(objMouse);
Re: Mouse Class - Listener Problems Patrick Bay
9/9/2004 9:43:02 AM
Hi,

You could try either '_parent' instead of 'this', or you could change
your code to this:

objMouse = new Object()
objMouse.onMouseUp = mouseListener
parentRef=this;
function mouseListener () {
trace(parentRef);
}


Regards,
Patrick

[quoted text, click to view]
AddThis Social Bookmark Button