How to make an image appear when hovering over tex

2019-08-10 12:53发布

问题:

How would the .fla that has text and when mouse is over that text an image appears look like?

I was thinking to make the text a button and then add some script....

回答1:

This is relatively simple

First, you'll need to make a MovieClip symbol containing your text.

Give that symbol instance a name (say mClip1)

Then, import your image and create a symbol from that too. Name it (e.g. img1)

Then, hide the image

img1.visible=false;

Next, add the MOUSE_OVER and MOUSE_OUT event listeners to mClip1

mClip1.addEventListener(MouseEvent.MOUSE_OVER, mOver);
mClip1.addEventListener(MouseEvent.MOUSE_OUT, mOut);

Finally, declare those event listeners and define them

function mOver(e:MouseEvent):void {
    img1.visible=true;
}

function mOut(e:MouseEvent):void {
    img1.visible=false;
}

Download the demo file (Flash CS5) from http://www.uploads.sc/download.php?file=749ce36c801a9bf18ce1b5033d8fd82f



标签: flash image cs3