3 Replies Latest reply on Jul 13, 2010 8:07 AM by captain_code-KOo9rr

    UIMovieClip error #1009, Focus Manager

    markmiddleton

      Hello, I wouldn't post here if I wasn't desperate to fix this, I've  tried everything I can think of. Here's what I'm using:

      Flash Builder 4
      Flex 4 SDK 4.0.0.14159

      I have a pretty simple isometric game with moving items and characters.

      Here's the error I'm getting:
      TypeError: Error #1009: Cannot access a  property or method of a null object reference.
      at  mx.flash::UIMovieClip/addFocusEventListeners()[E:\dev\4.0.0\frameworks\projects\flash-int egration\src\mx\flash\UIMovieClip.as:4758]
      at  mx.flash::UIMovieClip/focusInHandler()[E:\dev\4.0.0\frameworks\projects\flash-integration \src\mx\flash\UIMovieClip.as:4835]
      at flash.display::Stage/set focus()
      at  mx.flash::UIMovieClip/setFocus()[E:\dev\4.0.0\frameworks\projects\flash-integration\src\m x\flash\UIMovieClip.as:4455]
      at  mx.managers::FocusManager/activateHandler()[E:\dev\4.0.0\frameworks\projects\framework\sr c\mx\   managers\FocusManager.as:688]

      So, the error is not occurring in my  code, but in the UIMovieClip class, so I  can't debug it. I also do not have a way to reliably reproduce it. It  seems to happen when I click outside of the flash window, like on  another browser tab, taking focus out of the window, but it doesn't always happen, and I can't make it happen, it just pops up sometimes. I've found this  blog post that suggests that the solution for this problem is to remove focus from any UIMovieClip before you remove it from the display list:

      http://captaincode.wordpress.com/200...kit-for-flash/

      I've tried going through my entire application, and before I remove  anything from the stage using removeChild(), I run a function to move  the focus manager off of it and onto something else, and this error still occurs. This guy points to this bug  as the culprit:

      https://bugs.adobe.com/jira/browse/SDK-24015

      but the jira says that this bug is fixed in 4.0.0.12756, and I'm using a  later build than that.

      I also found this forum post:

      http://forums.adobe.com/thread/465181

      Where this guy solved a similar problem by targeting flash player 10,  which I'm doing.

      I have lots of UIMovieClip flash  components created in Adobe Flash CS3 and using the flex component kit  for flash.

      Does anyone have any idea what is causing this error or how to get rid of it?