This video illustrates an incredibly powerful way to minimize the amount of code you need to add eventListeners to tons of movie clips, in this case 8:) This could be one of the most important techniques you need to greatly optimize your code. This video also sheds some light on the confusing difference between ROLL_OVER and MOUSE_OVER. Hours of hair pulling can be avoided.
Please read WastedPotential.com: target vs currentTarget for an excellent written and interactive explanation of the concepts discussed in this video. The rest of his blog is full of really useful info.
Code Used in this Movie
import com.greensock.*;
import com.greensock.easing.*;
//add hand cursor
nav_mc.buttonMode = true;
nav_mc.useHandCursor = true;
//assign eventListeners
nav_mc.addEventListener(MouseEvent.MOUSE_OVER, navOver);
nav_mc.addEventListener(MouseEvent.MOUSE_OUT, navOut)
//on mouse over do this
function navOver(e:MouseEvent):void{
trace(e.target)
TweenMax.to(e.target, .8, {scaleY:2, ease:Back.easeOut});
}
//on mouse out do this
function navOut(e:MouseEvent):void{
TweenMax.to(e.target, 2.5, {scaleY:1, ease:Back.easeOut});
}
}
Download Fla and Swf: SnorklTV-Sample -target-vs-currentTarget
Learn More About TweenMax:
My Introduction to TweenMax
Greensock Tweening Platform Official Site






