Copy link to clipboard
Copied
Can some tell me why since upgrading to the Flex SDK 4.6 a TextArea does not return the correct size using getBounds? It seems to have an extra 18pixels added to the top and left. I have written a test script to prove the point. Any help would be appreciated as this is now causing me problems in a live application.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="onCreation()">
<fx:Script>
<![CDATA[
import spark.components.RichEditableText;
public function onCreation() : void {
var bounds:Rectangle = box.getBounds(this);
trace(box.width);
trace(bounds);
}
]]>
</fx:Script>
<s:TextArea x="0" y="0" width="200" height="50" top="0" id="box"/>
</s:WindowedApplication>
Copy link to clipboard
Copied
Use of the low-level getBounds is not recommended in UIComponents. It will factor in hidden display objects.
Copy link to clipboard
Copied
So whats recommended? No offense, but that's a pretty glib answer.
Copy link to clipboard
Copied
I’m not sure what you are trying to accomplish. The width/height are usually the answer.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui