Posts Tagged ‘var’

SystemManager.application == null using SWFLoader or Loader

September 2, 2009 3 comments

So you need access to the application property inside the system manager you just loaded using SWFLoader or Loader huh?

There are two options:

1. Listen for the FlexEvent.APPLICATION_COMPLETE event on the System manager after the loader fires the Event.INIT event.

However, that sucks if you need access to the application before it has finished its construction.

While it isn’t ideal for my situation (I wanted access to the application before the initialize event was fired), I was able to get hold of the application after the initialize event had been fired, but before the creation complete event had been fired.

2. Listen for the Event.ENTER_FRAME event on the system manager, and check if the application property is not null. Tada. Crappy I know, but what can you do?

Also, remove the event listener once you have access to the application (unless you want it?).