Groups | Blog | Home
all groups > flash (macromedia) > november 2003 >

flash (macromedia) : Animated Cursor OnMouseOver Only!


chakytori
11/24/2003 11:37:59 PM
Hi i have a code to put an animated cursor on my banner (ex. here: http://dkch.net/intercampus/banners/doctor_c.swf) as you can see the click here cursor appears but on my webpage still shows even if the cursor isn't in the banner area how can i make flash to only show the cursor when the mouse is actually in the banner area? the code is:

onClipEvent (load) {
Mouse.hide();
startDrag(clickhere,true);
}


urami_
11/25/2003 9:59:14 AM

[quoted text, click to view]


just preview it in HTML in actual size .
SWF open in browser fill the entire window , so your drag continue
within flash boundaries, in this case whole screen.




Regards

urami_*



<lsym>

There's no place like 127.0.0.1

chakytori
11/25/2003 10:02:57 AM

Ok, here you can see what i mean:

http://dkch.net/flash.html

even if the mouse isn't over the banner the cursor still blinks and shows, how can this be eliminated? i dont know the code but may be with some unload movie after the mouse has been put out???

urami_
11/26/2003 8:10:32 AM

[quoted text, click to view]

give it a timer . if there is no mouse activity , turn off the visibility , if the mouse is moving again
show the draggable .

onClipEvent (mouseMove) {
t0 = getTimer();
}
onClipEvent (enterFrame) {
if (getTimer()-t0>=10000) {
trace ("idle for 10 seconds");
// your action here to play things
}
}

This method however is not as neat as it could be .
See , it will continue to kick of the action every following 10 seconds of idle.
Bad idea definitely ...
So i made one more version :

onClipEvent (load) {
this.idle = true;
ox = _root._xmouse;
}
onClipEvent (mouseMove) {
if ((ox != _root._xmouse) || (oy != _root._ymouse)) {
// trace("moved");
ox = _root._xmouse;
oy = _root._ymouse;
t0 = getTimer();
if (this.idle) {
this.idle = false;
// trace("setting to false");
this._visible=1;
}
}
}
onClipEvent (enterFrame) {
if ((getTimer()-t0)>=5000) {
if (!this.idle) {
trace("idle for 5 seconds");
this.idle = true;
this._visible=0;
// or some other action
}
}
}


What happen here - the idle is check based on Xmouse move ,
if the mouse chill for 5 seconds it kick of the idle script and call action like
this._visible=0; or whatever is that you want to do.
Once the action it called it will cancel the idle script till you next mouse move.
So it does not continue counting every following 5 seconds .
Neat and CPU friendly compare to first version.





Regards

urami_*



<lsym>

There's no place like 127.0.0.1

AddThis Social Bookmark Button