This is why we can’t have nice things
The more I code, the more I think coding is for tools. For tools, by tools, to keep all the power in the hands of the needy pedants that have the time and delusion to keep track of the absolute normative disaster that are programming languages. For instance, let’s just say you want to have a little border resize to your image in your wee Flex app, that should be easy, right? Just get the size of the image and change the border to be a bit bigger. Oh wait…
- width is the width of the Image loader control and not the loaded image’s. If this property is not set, it will be adjusted automatically based on the loaded image’s width. The auto adjustment will not occur in the Image control’s complete event. This value will be updated in the last updateComplete event (the one after the complete event).
- contentWidth is the width of the loaded image when scaled. The loaded image has not been scaled yet in the Image control’s complete event so you won’t get the correct value, you will get the original width instead of the scaled value. You have to wait for the Image control’s updateComplete event after the complete event finishes to get the correct value.
- content.width is the width of the loaded image without regard to scaling. This will be immediately available during the Image control’s complete event. Note that content is actually the loaded image.
Right? And Actionscript is one of the easy languages (reason number two why it’s now cool to hate Flash, along with “Steve told me to.”).