I think the ActionScript class that the compiler generates from your MXML file has its own autogenerated override of initialize(). You can confirm this by using the -keep option. I don't remember what the autogenerated initialize() does, but -keep will show you.
Assuming I'm right, I agree that this is an annoying thing for the compiler to be doing, so you should file a bug.
Adobe Flex SDK Team
1 person found this helpful
Limitation. The MXML compiler generates its own initialize override to
handle the instantation of the stuff in the MXML file. Try using the
initialize event instead.
Yes, indeed I can listen instead for "preinitialize" event.
My main purpose with overriding "initialize" method was to put breakpoint into my custom class during debugging, can be easily workarounded with putting the breakpoint into the custom listener for "preinitialize" event.
I will not submit a bug and I will treat this situation as a "matter of life"
Let's remember that the <s:Application> tag actually is the MXML tag to instanciate the actionscript class: spark.components.Application.
You cannot define that method because it's already defined in Application.as, and also you're not extending the Application class to override its methods.
We also know actionscript 3 doesn't support method overloading, so that you cannot define two methods with the same name.
It's not a bug at all.
No. When you write an MXML application MyApp.mxml with root tag <s:Application> you are defining
public class MyApp extends spark.components.Application
Similarly, if you write an MXML component MyButton.mxml with root tag <s:Button> you are defining
public class MyButton extends spark.components.Button
If you don't believe me, use the -keep option and look at the autogenerated code.
An <s:Button> inside an app does indeed create an instance of Button, but an <s:Button> tag at the root (or inside an <fx:Component> or <fx:Definition> tag) defines a subclass, which other code can create instances of. In the case of MyApp, it is an autogenerated subclass of SystemManager that creates the instance of MyApp.
Adobe Flex SDK Team
Yes, you are write! I have done this test.