How to make an image appear when hovering over text in Flash cs3?

故事扮演 提交于 2019-12-13 00:26:49

问题


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



来源:https://stackoverflow.com/questions/8252225/how-to-make-an-image-appear-when-hovering-over-text-in-flash-cs3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!