This is probably old news by now, but I just found out you can implement an interface in an MXML component. In the past I’ve always made a base class that implemented the interface and had the MXML inherit from that. A big waste of time for small components.
-
<?xml version="1.0" encoding="utf-8"?>
-
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
-
implements="com.roguedevelopment.schedule.ui.ApplicationView">
-
…
-
</mx:Canvas>
You just need to add an “implements” attribute to your root tag and specify the full class name. I’ll stick to the base class for large components, but this is the way to go for small, quick things.

0 Responses to “Implementing interfaces in MXML”