On Mouse Out
drockon

Hello.

First let me say thanks for a really great project )
Second i'm not sure where to ask a question but will try it there.
I can't get to work a onmouseout event. Dunno if it's even possible but can't see why a code like this:
 
CardObject.onmouseout = function ()
        {
            console.log('mouse out');
        }
 
doesn't work(
Thx in advance and sorry if a noobs question.
All 6 Comments
Gio
Hi and welcome
 
There is no onMouseOut event (at the moment, but if you and other people think it's useful we will add one).
 
You can do what you're describing with onMouseMove events though. The idea is that you register your CardObject as a "global event listener" for mouse move events.
 
This means that it will receive mouse move events (i.e. its onMouseMove event function will be called) not only when the mouse if moved over it, but also whenever the mouse is moved anywhere - this is what "global" event listener means.
 
Then in your onMouseMove function, you can check whether the mouse is over your object or not, like this (in the following code I'm assuming that your object has only one sprite):
 
wade.addGlobalEventListener(cardObject, 'onMouseMove');cardObject.onMouseMove = function(eventData){    // check to see if the mouse was moved over the object    var sprite = cardObject.getSprite();    if (wade.boxContainsPoint(sprite.boundingBox, eventData.screenPosition))    {        // the mouse is moved over the object    }    else    {        // the mouse is moved outside the object    }}
drockon

Thanx.

onMouseOut woud be convenient in my opinion although might not really be often used.
Gio

Ok guys, there isn't enough time to get it into 0.8.3, but we'll see what we can do for 0.9.

Gio

Imminent is the right word - wade 0.8.3 will be available early next week, 0.9 before the end of the month, hopefully.

Gio

I can confirm that this is going to be in 0.9, I've just finished implementing it.

drockon
 
    Thanx a lot!  
Post a reply
Add Attachment
Submit Reply
Login to Reply