Flex图像鼠标悬停
我有下一个代码显示图像,当鼠标悬停时更改它。
<mx:Image source="{ConfigApp.getResourcesPath()}/img.jpg" id="imgOne"
mouseOver="imgOne.source=ConfigApp.getResourcesPath()+'/img_over.jpg'"
mouseOut="imgOne.source=ConfigApp.getResourcesPath()+'/img.jpg'"/>
我有两个问题:
第一:如果我将鼠标快速移过图像,有时会出现 mouseOver 图像的图像状态(不检测 mouseOut 事件)。
第二:在鼠标悬停的那一刻,有几毫秒没有任何图像,因此每次鼠标悬停时,它看起来都像白色闪光。
I have the next code that show a image and when mouse is over change it.
<mx:Image source="{ConfigApp.getResourcesPath()}/img.jpg" id="imgOne"
mouseOver="imgOne.source=ConfigApp.getResourcesPath()+'/img_over.jpg'"
mouseOut="imgOne.source=ConfigApp.getResourcesPath()+'/img.jpg'"/>
I have 2 problems:
1st: If I pass fast with the mouse over the image, some times the image state with mouseOver image (don't detect the mouseOut event).
2nd: In the moment that mouse is over there are a few miliseconds when the aren't any image, so its looks like a white flash every time that mouse is over.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第二期:
每次都会加载图像,在远程连接时这种闪光会变得更糟。相反,cahce 类中的图像并切换类引用。
然后像这样切换它们......
2nd issue:
Its loading the image each time, this flash will get worse when on a remote connection. instead, cahce the image in a class and switch the class reference.
Then switch them like this...
我宁愿做这样的事情,它解决了所有问题:
就这一点而言,如果您希望图像在重新加载时不闪烁,您应该有两个图像,一个在另一个上,其中背景图像仅在前景图像加载后才重新加载完成加载。实际上,您的图像闪烁,但您看不到它:
I'd rather make something like this, it solves all the problems:
To the point, if you want your image not to blick on reload, you should have two images, one on another, where background one reloads only after the foreground one has completed loading. Actually, your image blicks, but you don't see it: