Home > Flex, programming > Removing ugly yellow focusRect in Flex

Removing ugly yellow focusRect in Flex

October 10th, 2008 admin Leave a comment Go to comments

Right now I’m working on a project in which Flex integrates Flash components in its application and we encountered the infamous yellow focus borders when hitting the tab key from inside the application.

It wasn’t as easy as I thought it would be to Google the solution to prevent the ugly yellow rectangles from being displayed. I’ve found the solution in the Flex help though, so I’ll try to improve the search results on Google by providing the solution here.

When you look at the focusRect property description of flash.display.InteractiveObject, it says: “Specifies whether this object displays a focus rectangle. A value of null indicates that this object obeys the stageFocusRect property set on the Stage.”
And there’s your solution! In your Flex application, create a method that is called on creationComplete and in this method add the following code:

stage.stageFocusRect = null;

Now all focus rectangles are globally disabled in your application. It’s as simple as that.

Categories: Flex, programming Tags:
  1. Rick
    October 27th, 2008 at 13:36 | #1

    Dank!

  2. June 2nd, 2009 at 10:36 | #2

    Thanks a ton. I’ve been trying to get rid of this little mf for days now!

  3. January 31st, 2010 at 20:48 | #3

    Thanks for helping googleize this solution :)

  1. No trackbacks yet.