图像不会动态刷新
我正在编写一个 Flex 应用程序来从 httpservice 接收 xml。这是可行的,因为我可以用信息填充数据网格。 xml 发送图像路径名。组合框发送新的 HttpService 调用 onChange。这会重新填充数据网格并将新图像放入 Flex 正在访问的文件夹中。
我想动态更改图像而不更改图像的路径名。
<mx:Canvas id="borderCanvas"><mx:Canvas id="dropCanvas">
<mx:Tile id="adTile"><mx:Image></mx:Image>
</mx:Tile></mx:Canvas></mx:Canvas>
这是我的组件。 我使用以下代码分配我的图像源:
var i:Number = 0;
while ( i <= dg_conads.rowCount){
var img:Image = new Image();
img.source = null;
img.source = imageSource+i+".jpg";
adTile.addChild(img);
i++; }
我最大的问题是图像不刷新。尽管我已阻止从 HTML 包装器和 ASP.Net 网站进行缓存,但我还是得到了相同的图像。图像自动加载到文件夹中并在文件夹中刷新,但我无法在应用程序中刷新图像。 我试过removeAllChildren();删除(adTile.getChildAt(0));但都不起作用。
I am writing a Flex application to receive xml from an httpservice. That works because I can populate a datagrid with the information. The xml sends image pathnames. A combobox sends a new HttpService call onChange. This repopulates the datagrid and puts new images in the folder that flex is accessing.
I want to dynamically change the image without changing the pathname of the image.
<mx:Canvas id="borderCanvas"><mx:Canvas id="dropCanvas">
<mx:Tile id="adTile"><mx:Image></mx:Image>
</mx:Tile></mx:Canvas></mx:Canvas>
This is my component.
I assign my Image sources using this code:
var i:Number = 0;
while ( i <= dg_conads.rowCount){
var img:Image = new Image();
img.source = null;
img.source = imageSource+i+".jpg";
adTile.addChild(img);
i++; }
My biggest problem is that the images are not refreshing. I get the same image even though I've prevented caching from the HTML wrapper and the ASP.Net website. The image automatically loads in the folder and refreshes in the folder but I can't get the image to refresh in the application.
I've tried removeAllChildren(); delete(adTile.getChildAt(0)); and neither worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会尝试使用:
如果这不起作用,请尝试在末尾附加一个随机数,即:
I would try using:
If that doesn't work, try appending a random number on the end ie:
您是否尝试过直接将 id="img" 添加到 mx:Image 标签中并删除 adTile.addChild(img);
在脚本中?
Have you tried to add id="img" into the mx:Image tag directly and remove adTile.addChild(img);
in the script?