Started to implement this solution and ran into a problem- I'm doing the same function over and over (which is why I wanted to just pass arguments through the triggered function in the first place) so I'm not sure what the best way to optimize this code is- do I need to rename the "overHandler" function for each object? Seems like a lot of extra code for such a great improvement
The code below is my actual code, before I simplified it for the example.
function movBar(pos:Number, wid:Number):void {
TweenLite.to(orangeBar, .5, {x:pos, width:wid});
}
btn_about.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler(event:Event):void {
movBar(39, 51.5);
}
btn_portfolio.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler(event:Event):void {
movBar(140.5, 81.5);
}
btn_approach.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler(event:Event):void {
movBar(255.5, 81);
}
btn_blog.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler(event:Event):void {
movBar(350.5, 9);
}
btn_contact.addEventListener(MouseEvent.MOUSE_OVER, overHnadler);
function overHandler(event:Event):void {
movBar(440, 71);
}