Help Haiti
Categories
Archives
- November 2011
- December 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
Recent Posts
Hi, I'm Grace! I'm an Interactive Media Designer in beautiful San Diego interested in all things web and healthy living. Welcome.
ActionScript 3: using hasEventListener
Published by Grace | Filed under Flash
I’m currently building out an interactive home page for Aviatech in Flash, and came across an issue when one movie clip controls the opacity of others on its roll over Mouse Event, while these “others” also have Mouse Events. Rolling over the “master” movie clip prevents the “others” from having their Mouse Events assigned, so implementing hasEventListener() has saved my project. Here’s a snippet of how I’ve implemented it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public function masterSquareRollOver(e:MouseEvent) { var s = e.currentTarget; //array of related square movieclips var parr = s.arr; //loop through array and only highlight if //Mouse Events have already been assigned if ( parr.length > 0 ) { for ( var p in parr ) { var proj = _stage.getChildByName(parr[p].name); if (proj.hasEventListener(MouseEvent.ROLL_OVER) ) { TweenLite.to(proj, .25, {alpha: 1}); } else { trace(proj.name+": No event listener, ROLL_OVER disabled"); } } } } |
I also came upon this community site where you can post your code and have others review it, or you can look up methods to see how others are implementing it into their code. Take a look at the query results for hasEventListener(). Happy coding!
January 25th, 2010





Leave a Comment