• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

getBounds() returns incorrect rectangle

Explorer ,
Oct 22, 2010 Oct 22, 2010

Copy link to clipboard

Copied

Riddle me this.  Here's my Flex app:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

   xmlns:s="library://ns.adobe.com/flex/spark"

   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

   creationComplete="cc();">

<fx:Script>

<![CDATA[

import spark.core.SpriteVisualElement;

protected function cc():void

{

var outer:Sprite = new Sprite();

var inner:Sprite = new Sprite();

inner.graphics.beginFill(0);

inner.graphics.drawRect(-10, -10, 20, 20);

outer.addChild(inner);

inner.x = inner.y = 100;

var spriteVisual:SpriteVisualElement = new SpriteVisualElement();

spriteVisual.addChild(outer);

addElement(spriteVisual);

trace(inner.getBounds(outer));

}

]]>

</fx:Script>

</s:Application>

The cc() function traces (x=90, y=90, w=20, h=20).  Here's my AIR app with the same code:

<?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="cc();">
<fx:Script>
<![CDATA[
import spark.core.SpriteVisualElement;
protected function cc():void
{
var outer:Sprite = new Sprite();
var inner:Sprite = new Sprite();
inner.graphics.beginFill(0);
inner.graphics.drawRect(-10, -10, 20, 20);
outer.addChild(inner);
inner.x = inner.y = 100;
var spriteVisual:SpriteVisualElement = new SpriteVisualElement();
spriteVisual.addChild(outer);
addElement(spriteVisual);
trace(inner.getBounds(outer));
}
]]>
</fx:Script>
</s:WindowedApplication>

The cc() function traces (x=-10, y=-10, w=20, h=20).
Why the disparity?  Arrrrg!  Is there a suitable workaround?  Thanks.
TOPICS
Performance issues

Views

723

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 25, 2010 Oct 25, 2010

Copy link to clipboard

Copied

Looks like this has already been reported as a bug: http://bugs.adobe.com/jira/browse/FP-5143 I cannot believe this issue actually made it into any AIR release build.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Oct 29, 2010 Oct 29, 2010

Copy link to clipboard

Copied

LATEST

Hi Aaron,

This bug (internal bug #2667566) should be fixed with the AIR 2.5 SDK and runtime release.  Please let me know if you find that isn't the case.

Thanks,

Chris

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines