图片中的柔性:如何改变的MX源时,为了避免闪烁 [英] how to avoid flickering when changing the source of an mx:Image in flex
问题描述
在我的MXML文件我有这样的声明图片:
in my mxml file I have images declared like this:
<mx:Image x="0" y="0" source="assets/bigpicture.png" id="picture1"/>
和在一些事件中,我做的:
and at some event I do:
picture1.source =财产/ bigpicture2.png;
picture1.source = "assets/bigpicture2.png";
不过,这将导致弯曲删除该图片,当它加载它会再次显示。
However this results in flex removing the picture, and when it has loaded it will show it again.
我怎样才能让MX:图像制作,这样它会继续显示图像直到新的图像已经加载
How can I make the mx:image make so that it will continue to show the image until the new image has been loaded?
谢谢!
推荐答案
为什么你不只是<一href="http://www.google.fr/url?sa=t&source=web&ct=res&cd=1&ved=0CAkQFjAA&url=http%3A%2F%2Fwww.adobe.com%2Fdevnet%2Fflex%2Fquickstart%2Fembedding%5Fassets%2F&ei=29rxStv%5FM9SMjAfwnvCVAQ&usg=AFQjCNEEGeBZ4fQvQz4utAjLdjDO7B3CsA&sig2=ZuMBl319C6ZPfuNqYPzkfA"相对=nofollow>嵌入您的资产的应用程序中,如果他们始终是相同的?
Why don't you just embed your assets in your application if they are always the same ?
如果您的图像必须在运行时加载: 我认为要做到这一点的唯一方法是分别从图像的加载程序,当加载器加载完成后加载的资产,将其指定为图像的来源。
If your images must be loaded at runtime: I think the only way to do it is to load the asset separately from the Image with a Loader, and when the Loader has finished loading, assign it as source of the Image.
否则,你可以淡出图像阿尔法= 0切换源之前,然后淡出回1.0。它看起来更平滑,但仍然会有,而新的加载任何图像显示。
Else, you can just fade the Image to alpha=0 before switching the source, and then fade it back to 1.0. It will look smoother, but there will still be no image displayed while the new one is loading.
这篇关于图片中的柔性:如何改变的MX源时,为了避免闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!