problem:
Searching at internet I didn’t find a correct distinction about the available values about the dimensions that Image component gives. Adobe's reference help of course has complete definition of these propoerties... but lets summarize them.
solution definition:
--- Image.width, Image.height
this is the width and height of the component that shows the image
--- Image.measuredWidth, Image.measuredHeight
these are the actual dimensions of the Image, irregardless the previous dimensions and if the image is scaled
--- Image.contentWidth, Image.contentHeight
these are the dimensions that image have now at the Image component, dimensions as scaled image
Further problem… Many values are returned as 0 zero or NaN
When you assign data to “data” property… the Image component doesn’t do all the do job it must do… you have to give it some time to complete all it's the pending issues…
Solution...
EVENT!!! Wait for the event Image’s event “updateComplete” and there… check again if the width property (you want) is NaN or not, using the isNaN function.
The event handler will look like this:
internal function Handel_imPhoto_updateCompleted(e:Event):void{
if (!isNaN(im_photo.measuredHeight))
height= im_photo.measuredHeight;
}
No comments:
Post a Comment