Flex:部署到服务器后图像缩放停止工作
我有一些代码可以在加载图像后根据图像的高度缩放图像的宽度。如果我使用本地文件系统路径指向包装器 html,它在我的开发 PC 上工作正常。然而,在我将 Web 应用程序部署到 JBoss AS 5.1 后,它停止工作 - 它总是将图像宽度设置为 0,导致它消失。还有其他人遇到类似的问题吗?
缩放图像侧代码:
private function scaleImage():void {
img.width = img.contentWidth;
}
<mx:Image id="img" updateComplete="callLater(scaleImage)" height="100%" />
I have some code to scale an image's width according to its height after the image is being loaded. It works fine on my development PC if I point to the wrapper html using local file system path. However, after I deploy the web application to JBoss AS 5.1, it stopped working - it always sets the image width to 0, causing it to disappear. Anyone else experience similar issues?
Code for scale image side:
private function scaleImage():void {
img.width = img.contentWidth;
}
<mx:Image id="img" updateComplete="callLater(scaleImage)" height="100%" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这是因为您挂钩了错误的事件,并且在调用
callLater
时该事件尚未加载。您确定updateComplete
是正确的事件吗?complete
看起来是更好的事件选择:http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html#event:complete
当然,如果您已从 Windows 迁移应用程序当环境更改为区分大小写的环境时,路径中的区分大小写可能会成为问题。
I imagine it's because you're hooking the wrong event and it hasn't loaded by the time
callLater
is called. Are you sure thatupdateComplete
is the right event?complete
looks like a better choice of event:http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html#event:complete
Of course, if you've migrated your app from a Windows environment to a case sensitive environment, case-sensitivity in the path might be an issue.