How to Make a Flash Rollover Image

by David Gitonga

With Flash, it is possible to create crazy effects that match what other programs such as Javascript are capable of doing. Rollover images can be used to create effects on a site, or they can be used as a means to navigate to other sections of a dynamic site. Using ActionScript allows a rollover effect to be more versatile in addition to ensuring that the animation remains small. Only a few lines of script are needed to move an object from state A to B to C.


Open a new Actionscript 3.0 Flash file.


Import your images. This is done by going to the menu \"File,\" \"Import\" and \"Import to Library.\"


Select the timeline and rename “Layer 1” to “Image 1.”


Drag an image from the library onto the stage.


Convert the image into a symbol. This is done by pressing F8 or going to the menu \"Insert\" and \"New Symbol.\"


Name the symbol “Image 1” and check “Movie clip” to convert it into a movie clip.


Click \"OK.\" A movie clip with the name “Image 1” appears in the library.


Give the movie clip an instance name “Image1_mc.\" Do this under the “Properties” panel located below the stage under the “Properties” tab.


Select the 30th frame on the timeline and hit F5 to add a frame.


Create animation by right-clicking anywhere between frame 1 and 30 and selecting “Create Motion Tween.\"


Select frame 30.


Select the image on stage and change its Alpha setting to 0 percent by going to the “Properties” tab under “Color.” The image on stage is now invisible.


Lock the “Image 1” layer and insert a new layer “Image 2.” Use the “Lock/Unlock All Layers” icon above the layers.


Select frame 55 of the “Image 2” layer and hit F5.


Select frame 25 and hit F6. This inserts a key frame onto the selected frame.


Drag “Image 2” onto the stage and press F8.


Select \"Movie clip\" and give it an instance name of “Image2_mc.\"


Create a motion tween between frame 25 and 55.


Select frame 25 and the image on stage and change the Alpha setting to 0 percent.


Select frame 30 and the image on stage and give it an Alpha setting of 100 percent.


Select frame 55 and the image on stage and set the Alpha setting to 0 percent.


Repeat the above steps for more images added. Insert a new layer named “Actions” and press F6 on frame 30 and 55 to add key frames.


Click on frame 1 of the “Actions” layer and press F9 to add the following code:<br />stop()<br />GO<br />image1_mc.addEventListener(MouseEvent.MOUSE_OVER,imageOver)<br />GO<br />function imageOver(event:MouseEvent):void {<br />play()<br />GO<br />}


Select frame 30 of the “Actions” layer and enter the code below:<br />stop()<br />GO<br />image2_mc.addEventListener(MouseEvent.MOUSE_OVER,imageOver2)<br />GO<br />function imageOver2(event:MouseEvent):void {<br />play()<br />GO<br />}<br /><br />Select frame 55 and under the Actions layer insert this line of code:<br />Stop();


Test the movie by pressing “Ctrl + Enter.” Your image rollover effect should now work.<br />Publish the animation by going to \"File\" and \"Publish.\"


  • check You can have as many objects as possible sliding in and out. Use graphics, input text and buttons embedded in the movie clip symbol to create dynamic animations.

Items you will need

About the Author

David Gitonga is a Web designer and has an associate degree in information technology and electronics. He has more than two years of experience in Web design and writing Web content and more than five years of experience in electronics. He has written a number of articles for various websites.

Photo Credits

  • photo_camera Jupiterimages/ Images