Initialization Order in Flash MX 2004

Did I mention homework sux? Taking a break between 10 billion essays + discussion board assignments to spiel some Flash stizz-nuff.

Someone commented on a really old blog entry asking a question about init order of components. Here’s the four one one.

In Flash MX, you had this compile time operator called #initclip. You would wrap your class code, typically on frame one inside of the movie clip that was your component. You’d place a number next to the #initclip to specify in which order the class should initialize in so you made sure your super classes instantiated before your sub-classes, and components that were used by other components were instantiated first, and then the ones using them followed.

I personally was ever able to break this, and I think it was because I would always place my component inside the component that used it… I’m not sure if that forces it correct, overrides the order #, or what… anyway, here was Flash MX:

#initclip 5
function MyClass()

In Flash MX 2004, the IDE handles this for you. It can detect the classes your utilizing/inheriting from, and with the IDE’s help of assets, it’ll auto-write the #initclip orders; you can see these if you decompile the SWF. You build your classes, then place the component inside the component that uses it. If it’s just a class with no GUI (damn programmer…) then as long as you have an import, or a fully qualified class path in the class that uses it, your good.

I’m sure I skrait foobarred some semantics, but the easiest way to get smart people to talk is to be dead wrong and they’ll happily correct you, so there I go.