Fundamental bug in Flex Builder 1.5?
Flex Builder 1.5 appears to have such a fundamental bug in it that I was actually afraid to post something about it earlier, without double-and-triple checking my results and extensively testing it out, for fear of having overlooked something very minor. Basically, Flex Builder loses the ability to preview your applications in Design View if you subclass mx.core.Application or mx.containers.Form. Although this is perfectly legal -- and actually, I would argue, a best practice (more on that later) -- and although the resulting applications run when compiled, Flex Builder's Design, Run and Debug features stop working.
I am still hoping that there is at least an undocumented way to tell Flex Builder, "Hey, I'm extending Application/Form, so you can go ahead and display it as if it was an Application/Form" but I haven't been able to find such a way as of yet (and I've looked extensively into to the extensibility layer for Dreamweaver too without any luck in locating hooks into the Flex Design View renderer.)
Thus, the following simple example renders correctly in Flex Builder:
While the following does not:
The code for the ApplicationSubclass, which you need to place in the WEB-INF\flex\user_classes\com\ariaware\flexbuilderbug folder of your Flex application, is given below:
Similarly, if you were to include a Form subclass instead, Flex Builder cannot render a preview of that either.
If, indeed, there isn't a way to get the current build to display subclasses of Application/Form correctly, this is a major, fundamental bug and needs to be fixed as the first order of business. Subclassing the Application and Form classes is how Flex applications should be built. By following this methodology, you remove all code from the MXML files, making your applications easier to maintain and scale. (The currently de facto practice of including <script> tags and mixing code into your MXML are stages that we went through in the Flash world and grew out of.) ARP also supports this latter method of working and, in a series of articles that will be released this month (along with an update to ARP itself), you will see how this way of working also makes it child's play to migrate applications from Flash to Flex.I do hope that there is a way to workaround this issue in Flex Builder currently and, if not, that it will be fixed in the next update.