AS3 MOUSE_OVER VS. ROLL_OVER

A lot of Flash developers I come across have an issue with mouse actions when MovieClips are embedded inside other MovieClips.  AS3 has multiple ways to handle embedded mouse actions within MovieClips.  The two main ways are MOUSE_OVER and ROLL_OVER.  They sound the same but have slight differences. 

MOUSE_OVER

MOUSE_OVER will be triggered when you first rollover the main MovieClip.  It will also be triggered every time you rollover any MovieClip inside the main MovieClip.  This can get dangerous when you have additional buttons inside the main MovieClip with MOUSE_OUT functionality.  Be careful because your MOUSE_OVER functionality will be called multiple times.

* If you set the main MovieClip to mouseChildren = false, it will prevent the MOUSE_OVER action being triggered when you mouse over any embedded MovieClip.  Be careful though because you will not be able to add any mouse actions to those embedded MovieClips.

ROLL_OVER

ROLL_OVER will be triggered when you first rollover the main MovieClip.  It will not be triggered again until you roll out of the main MovieClip and back over it.  You can rollover as many embedded MovieClips as you want without it being triggered multiple times.  ROLL_OVER is best for when you have embedded MovieClips with mouse actions.



 del.icio.us  Stumbleupon  Technorati  Digg 

 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this entry.
Comments

Leave a comment

Submitted comments will be subject to moderation before being displayed.

 Enter the above security code (required)

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.