3545 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

Hello FlashDeners

Is there anyway to detect when the mouse is leaving the scene in a Flash AS2 movie? I want something different than a roll out event. I would like to test it using the mouse position or another way.. I know that you can do this in AS3 , but can it be done in AS2 too?

Thanks, Ruben.

926 posts
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+4 more
michelsteege says

everything you can do in as2 you can do in as3 and more. anyway, it can be done in both as2 and 3 just check in a loop or interval the position of the mouse (between 1 and stage width – 2 and stage height -2) so you have a 1px border where it is leaving the stage. There is nog build in option for this though.

3545 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

you can’t do it that way .. i already tried and the movie thinks that your mouse is always in inside.
In as3 you have the “onMouseOver” or something like event so you can’t do in as2 this. :)

926 posts
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+4 more
michelsteege says

Ah i see what you mean, if you move fast the mouse stick to a old position for flash:

Anyway in as3 there is a event for it i saw:

stage.addEventListener(Event.MOUSE_LEAVE, onMouseLeave); function onMouseLeave(e:Event):void { trace(“the mouse has left the building”); }

In as2 is isn’t but you can use javascript and just say to flash when the mouse is of the embed flash element :)

But there is another way founded here on flashden:

http://www.flashden.net/forums/thread/as20-detect-when-mouse-leaves-swf/8327

:)

3545 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

Thanks so much :) I have to learn as3 :D

by
by
by
by
by
by