Skip to main content
Participant
January 17, 2012
Question

Since Flex SDK 4.6 the TextArea reports incorrect Bounds?

  • January 17, 2012
  • 1 reply
  • 1269 views

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>

This topic has been closed for replies.

1 reply

Adobe Employee
January 17, 2012

Use of the low-level getBounds is not recommended in UIComponents. It will factor in hidden display objects.

January 25, 2012

So whats recommended? No offense, but that's a pretty glib answer.

Adobe Employee
January 25, 2012

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