[ 
https://issues.apache.org/jira/browse/FLEX-11275?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Kessler closed FLEX-11275.
-------------------------------

    
> When an Image control is sized to a size smaller than the bitmap's 
> dimensions, querying the height and with does not give the correct result
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-11275
>                 URL: https://issues.apache.org/jira/browse/FLEX-11275
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: mx: Image
>    Affects Versions: Adobe Flex SDK 2.0 (Release)
>         Environment: Affected OS(s): All OS Platforms
> Affected OS(s): All OS Platforms
> Language Found: English
>            Reporter: Adobe JIRA
>            Assignee: Mark Kessler
>         Attachments: test.png
>
>
> This problem is essentially encountered by anyone showing thumbnails of 
> images which is very common. In such a situation, one generally determines 
> either the height or width at which to display images expecting the 
> <mx:image> control to adjust the other dimension appropriately. Which it 
> does. However, when you query the other dimension you get the original value 
> (unscaled). One ends up having to calculate the resulting dimension and 
> setting it to be the value of the height or width as the case may be. Quite 
> cumbersome really.
> Essentially, try drawing a border around scaled images to see the issue.
> Steps to reproduce:
> 1. Place and <mx:image> control and size it to a size smaller than the 
> original size of a bitmap
> 2. At run time query the height and width.
> 3.
>  
>  Actual Results:
>  The returned values of the height and with are the height and with of the 
> original bitmap
>  
>  Expected Results:
>  Since the <mx:image> control scales proportionately frequently one set 
> either the height or the width (and not both) to fit sensibly in the UI. But 
> one doesn't know the resulting height or width (as the case may be) after 
> scaling. I would expect the image control
>  
>  Workaround (if any):
>  The workaround is way too complex to be called a work around.
> // This is the image complete event handler.
> private function onImageComplete(event:Event):void {
>       if (!isNaN(image.explicitHeight) && image.explicitHeight != 0) {
>         image.width = image.contentWidth -  image.contentWidth / 
> (image.contentHeight / (image.contentHeight - image.height));
>       }
>       else if (image.explicitWidth != 0) {
>         image.height = image.contentHeight -  image.contentHeight / 
> (image.contentWidth / (image.contentWidth - image.width));
>       }
>       dispatchEvent(new Event(EVENT_COMPLETE));
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to