Skip to main content
miquael
Inspiring
July 2, 2011
Answered

how to remove yellow bounding box?

  • July 2, 2011
  • 1 reply
  • 1290 views

As I understand,

stage.stageFocusRect = false;

will remove the yellow bounding box around buttons in my Flash app.

However, it is throwing an error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Is there a dependency I need to import first?

Also, it is essential that I retain the ability to have key press event handlers (which is why the yellow bounding box is showing up).  So will stage.stageFocusRect remove the ability to use key press commands?

If so, is there any way to retain keypress commands and remove the yellow bounding box?

thanks

This topic has been closed for replies.
Correct answer kglad

you just need to wait until your display object is added to the display list before trying to reference its stage property.  ie, use the addedtostage event:

this.addEventListener(Event.ADDED_TO_STAGE,init);

private function init(e:Event):void{
stage.stageFocusRect=false;

}

/////////////////////

and your stage will still be responsive to events as usual.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
July 2, 2011

you just need to wait until your display object is added to the display list before trying to reference its stage property.  ie, use the addedtostage event:

this.addEventListener(Event.ADDED_TO_STAGE,init);

private function init(e:Event):void{
stage.stageFocusRect=false;

}

/////////////////////

and your stage will still be responsive to events as usual.

miquael
miquaelAuthor
Inspiring
July 5, 2011

Thanks Kglad!  Works perfect!  Nice one.

kglad
Community Expert
Community Expert
July 5, 2011

you're welcome.