1

I've got a problem with rotated buttons in Flex. They seem to contaminate other components' focus rectangles.
Take the following source code, which couldn't be much simpler:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:VBox width="100%" height="100%">
        <mx:Spacer height="100" />
        <mx:Button rotation="10" />
        <mx:TextArea rotation="0" />
    </mx:VBox>
</mx:WindowedApplication>

Now execute it. Click in the text area, the focus rectangle is correct. Press tab twice, the focus rectangle aroung the TextArea is rotated!

Is there a fix for this, or should I avoid rotating buttons altogether?

I'm using Flex SDK 3.5.

Thanks,

Daniel

2 Answers2

2

I as well recently stumbled upon this bug. Here's a link to suggested fix.

However, I was wondering if there's a more general solution rather then extending each and every component and overriding adjustFocusRect.

I came up with extending FocusManger and overriding the getter for focusPane as follows:

override public function get focusPane():Sprite
{
    var fp:Sprite = super.focusPane;
    if (fp && fp.numChildren != 0)
        fp.getChildAt(0).rotation = 0;

    return super.focusPane;
}

and set it as application's focus manager:

private function onPreinitialize():void
{
    application.focusManager = new FocusManagerEx(this);
}

This seems to work, though would be nice if some expert could tell if there aren't any pitfalls I'm not aware of.

Community
  • 1
  • 1
Mr. Newb
  • 96
  • 2
1

Seems like a bug in Flex SDK. I see next options:

  • disable focus rectangles with focusSkin="{null}"
  • implement your own skin and handle rotations correctly
  • move to Spark, since 3.5 is the (currently) last SDK of third generation
  • try to fix it yourself (I feel it will be tricky...)

Also, you may file a bug in Adobe's tracker, but they're deep into 4-th generation of Flex.

Update: 3.6 nightly build contains this bug, too.

alxx
  • 9,897
  • 4
  • 26
  • 41