We use the AS extends MXML approach. We layout visual components in the MXML
and then extend it with functionality which is added in the AS class. The
only problem we came across with this approach is extending this AS class
with MXML, which is not possible. In the rare case that we do need to extend
it, we convert the MXML to a new AS class or add the layout of the
components to the existing (originaly extending) AS class.

Works really well, you get code hinting for the components layed out and
gives you all the freedom you need. An example:

MyClassVisual.mxml (extends VBox)

<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml";>
   <mx:Button id="btn" />
</mx:VBox>

MyClass.as

package myClasses
{
   public class MyClass extends MyClassVisual
   {
      public function MyClass()
      {
      };

      override public protected function childrenCreated():Void
      {
         super.childrenCreated();

         btn.label = "My Button";
      };
   };
};



Greetz Erik

Reply via email to