动作脚本 3:悬停时显示图形?
基本上我有一个照片库,照片上方有图形,并有文字说明图像的内容。我不确定如何在 Flash 电影开始时将图形设置为visible = false?另外,我将如何实现它,以便仅当用户将鼠标悬停在某些图像上时才显示图形?
Basicly I have a photo gallery which has graphic above the photos with text saying what the image is of. I am not sure on how to set the graphic to visible = false at the start of the flash movie? Also how would I achieve it so it only shows the graphic when the user has its mouse hovered over the certain images?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的情况下,您基本上需要向带有照片的对象添加两个事件:MOUSE_OVER 和 MOUSE_OUT。当用户将鼠标指针移动到您的照片上时,您将发生 MOUSE_OVER 事件,因此您将使照片描述可见。
myHint.visible = true;
当鼠标离开您的照片时,您将收到 MOUSE_OUT 事件,您可以在其中隐藏提示
myHint.visible = false;
。我建议创建一个带有儿童照片和后鹿的物体。因此,每张照片都会有它自己的描述对象,您可以轻松地获取它们,例如
myPhotoObject.myDescriptionHint
。我还建议您阅读有关 as3 中的事件处理的内容。这将回答您的大部分其他问题。
更新
在alxx发表评论后,我发现这篇有用的文章介绍了 MOUSE_OVER 和 ROLL_OVER 事件之间的区别
In your case, you basically need to add two events to your object with a photo: MOUSE_OVER and MOUSE_OUT. When user move mouse pointer on your photo, you will have a MOUSE_OVER event, so you will make the photo description visible.
myHint.visible = true;
And when mouse leave your photo you will have MOUSE_OUT event, where you can hide your hint
myHint.visible = false;
.I recommend to create an object which has a photo and a hind as a children. So every photo will have it's own description object, and you could easily get them something like
myPhotoObject.myDescriptionHint
.I also recommend you to read about event handling in the as3. This will answer most of your additional questions.
UPDATE
After comment from alxx, i found this helpful article about difference between MOUSE_OVER and ROLL_OVER events