PDA

View Full Version : ROLL_OVER / ROLL_OUT issue


christian_s
08-28-2008, 09:52 AM
I'm in the process of writing a 'elastic' tooltip class, where the tooltip follows the mouse with a small delay, making it look like an 'elastic' effect.

You can se an example here:
http://www.2xmedie.dk/develop/tooltip/
(Try to touch the tooltip with the mouse)

Sourcefiles here:
http://www.2xmedie.dk/develop/tooltip/source.rar

There's one issue though: When the mousepointer touches the tooltip it self, it causes an MouseEvent.ROLL_OUT on the target movieclip
This is causing the tooltip movieclip to 'flicker' since ROLL.OVER and ROLL.OUT are called constantly.

Can I some how, make sure, that the MouseEvent.ROLL_OUT is NOT called, when the mousepointer touches the tooltip movieclip?

I was looking at the method preventDefault() - but I'm not sure how to implement it.

Can someone please advice?

rawmantick
08-28-2008, 10:06 AM
Use MOUSE_MOVE and check some flag if cursor is above clip. By MOUSE_OVER and MOUSE_OUT set the flasg to true or false

christian_s
08-28-2008, 10:59 AM
I can certainly see your point - but it's still behaving in a unpredictable way...
It's not quite working..

christian_s
08-28-2008, 11:09 AM
When I try this approach, the MouseEvent.MOUSE_OUT is never triggeret and the tooltips stay on the stage.

rawmantick
08-28-2008, 11:58 AM
It's be because mouse leaves green square when there is a black tip between them (between mouse and green). So event is not captured.

MadKitsune72
08-28-2008, 12:11 PM
Perhaps, rather than having a ROLL_OUT on your green square, use a ROLL_OVER on a transparent movieClip in the background.

christian_s
08-28-2008, 12:20 PM
The solution with boolean flags, sounds like a good idea, but it does not really work.
The boolean flag is set on every new entered frame (30 fps) and flash does not really keep up the pace with the eventlisteners.

You are welcome to try this approach - I can not make it work..

christian_s
08-28-2008, 12:23 PM
Thanks for the tip MadKitsune72, but this approach will also produce a MouseEvent.ROLL_OUT on the green square - leaving me in the exact same situation:
A ROLL_OUT event is dispatched when ever the mouse touches the black tooltip movieclip.

Arrgh..

MadKitsune72
08-28-2008, 02:43 PM
I was suggesting you completely remove the ROLL_OUT listener from the green box, and have the ROLL_OVER on the background perform that function.

snickelfritz
08-28-2008, 02:53 PM
tooltip.mouseEnabled = false;

Canazza
08-28-2008, 02:59 PM
You can use a MOUSE_MOVE event

stage.addEventListener(MouseEvent.MOUSE_MOVE,funct ion(e:MouseEvent) {

if(myMovieClip.hitTestPoint(e.stageX,e.stageY,true )) {
trace("OVER")
}
})

MadKitsune72
08-28-2008, 03:15 PM
tooltip.mouseEnabled = false;

Seriously? Does this actually work? If so, I could have saved myself so much time on a number of projects!

Canazza
08-28-2008, 03:22 PM
Seriously? Does this actually work? If so, I could have saved myself so much time on a number of projects!

:O
/facepalm
it does work

snickelfritz
08-28-2008, 03:23 PM
D'oh!
:)

defkon
08-28-2008, 10:41 PM
wow , i could have saved myself some serious amount of transparent movie clips!

Anil_kumar
08-29-2008, 05:18 AM
:)

just add these two lines in Main.as

this.pageContainer_mc.addChild(new ToolTip(this.block, this.toolTipGfx, "hello world", 0x666666, "TL"));
/*******************************************/
var newMC =pageContainer_mc.getChildAt(1);
newMC.mouseEnabled = false;
/*******************************************/

then edit your symbol "ToolTip_mc" from library and BreakApart "ToolTipBg_mc" .

if it doesn't work please contact me i will u give you the source file (your file ;) )


Ragards

Anil
Flash Workshop (http://flash-workshop.blogspot.com/)
anilkumarnd@gmail.com