PDA

View Full Version : alpha rollOver thumbnails


dans1970stang
11-17-2009, 08:43 PM
Hey guys. Yep another rollover question dealing with changing the opacity of the button. Anyways...after digging through the site I found this:

stop();

thumb1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
thumb1.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);

function mouseOverHandler(e:MouseEvent):void
{
thumb1.alpha = 1.0;
}

function mouseOutHandler(e:MouseEvent):void
{
thumb1.alpha = .5;
}


This line of code worked, except only for the first image. After duplicating this code 4 more times (and replacing each instance name accordingly) it threw the "duplicate function definition" error. In case this helps, here is how I constructed the timeline
http://img39.imageshack.us/i/picture2he.png/

I choose this code specifically as I wanted to avoid using motion tweens to animate the opacity change as the site will contain over 100 images (but broken up into groups of about 20). I'm sure this isn't the best choice for displaying a large quantity of images, but I am still learning.


Also, what book might you guys recommend that I pickup to better understand coding?

Thanks for the help!

dans1970stang
11-17-2009, 09:18 PM
Did not know that "mouseoverhauler" had to be a different name for each thumbnail.

If you guys have any suggestions for a book i'd appreciate it :)