3239 posts Nice Guy
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
+6 more
RubenBristian 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.

900 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 7-8 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
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.

3239 posts Nice Guy
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
+6 more
RubenBristian 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. :)

900 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 7-8 years
  • Netherlands
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
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

:)

3239 posts Nice Guy
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
+6 more
RubenBristian says

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

by
by
by
by
by
by