3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 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.

940 posts
  • Affiliate Level 3
  • Author Level 5
  • Collector Level 2
  • Top Monthly Author
+5 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.

3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 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. :)

940 posts
  • Affiliate Level 3
  • Author Level 5
  • Collector Level 2
  • Top Monthly Author
+5 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

:)

3804 posts
  • Elite Author
  • Author Level 11
  • Trendsetter
  • 7 Years of Membership
+12 more
KrownThemes
says

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

by
by
by
by
by
by