문제

I have found some problems in displaying images larger than 10000px width or height in spark Image component. Despite of setting maximum width/height or explicit width/height to larger sizes the image is being scaled down to 10000px.

<s:Image id="image" source="big.jpg" maxWidth="20000" maxHeight="20000" width="14400" height="10800" x="-9200" y="-8200" />
<s:Label id="debug" />

I set these coordinates to be sure I see the bottom right corner of image (it's scaled down proportionally). In debug I'm displaying the mouseX and mouseY of image.

protected function application1_mouseMoveHandler(event:MouseEvent):void
{
  debug.text = image.mouseX + ", " + image.mouseY;
}
도움이 되었습니까?

해결책

Image component uses BitmapImage internally: Image.imageDisplay.

If BitmapImage works fine, manually setting maxWidth and maxHeight of Image.imageDisplay might fix the bug.

Added:

When you manually setting the maxWidth and maxHeight of imageDisplay, I recommend using a custom Skin to set them. Or they could be set after the image is loaded and scaled already.

Additional Information:

The default value of BitmapImage.scaleMode is stretch, but the default value of Image.scaleMode is letterbox. So, if you see BitmapImage works fine but Image scales differently, check this property.

다른 팁

The answer is simple - check out the documentation: http://flex.apache.org/asdoc/spark/components/Image.html

Maybe I should write it here, as nobody actually reads that docs - 10k is the limit of both width and height for that component.

edit: Are you serious you need image larger than 10k?! Can you imagine how much memory this is? :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top