Flex 3: mx:Application.applicationComplete vs creationComplete

| | Comments (4) | TrackBacks (0)

I'm working on a media player in Flex and I ran into an issue.

Background
When you click the "Fullscreen" button I change the label to "Exit Fullscreen" and vice versa when you click it again. If you use ESC key to return from fullscreen the label stays the same.

No problem right? I'll add

stage.addEventListener(FullScreenEvent.FULL_SCREEN, handleFullScreen);

to my init() function which is called from the creationComplete and I'm done, right?

Problem
"creationComplete":http://livedocs.adobe.com/labs/flex3/langref/mx/core/UIComponent.html#event:creationComplete - "Dispatched when the component has finished its construction, property processing, measuring, layout, and drawing."

Basically, when creationComplete is called the stage object is null. Huh? Yep, that's right...it is null.

Solution
I found a blog post by Raghu where he talked about using the SystemManager. That seems really hack'sh (which he felt the same as well). He then pointed out a blog post by Wietse Veenstra which shows the start-up order.

Bottom line, applicationComplete is the event we should use for init'ing our application. creationComplete should be used for init'ing children of the application, if needed.

Hopefully this will help someone as it has helped me. God bless the blogosphere! ;-)

Categories

0 TrackBacks

Listed below are links to blogs that reference this entry: Flex 3: mx:Application.applicationComplete vs creationComplete.

TrackBack URL for this entry: http://mt.johncblandii.com/mt-tb.cgi/78

4 Comments

Popoburns said:

Yo man! thanks for the tip! you've been a great help posting this info!

John C. Bland II Author Profile Page said:

No sweat man.

Use "callLater":
creationComplete="callLater(init)"

;)

John C. Bland II Author Profile Page said:

Yeah, but why? applicationComplete is what I use and suggest you use.

Leave a comment

   Navigation  

  

   Feed Info

Add to Technorati Favorites

About this Entry

This page contains a single entry by John C. Bland II published on February 13, 2008 4:10 PM.

SQLite Admin Tool was the previous entry in this blog.

FMS & AS3: NetConnection.client and NetStream.client is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.12

CFWACK 8 Links