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(sca开发者_StackOverflowleImage)" height="100%" />
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 that updateComplete
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.
精彩评论