How to create an AIR application in Flash Builder 4 without mxml
I am an actionscript developer and I know nothing when it comes to mxml. recently switched to using flash builder and I really like it but I want to create an AIR application in flash builder but I don't want to use mxml since I don't need any of the built in framework to accomplish my goal.
- Is that possible?
- If I have to use mxml to start the application how do I use .as files with .mxml files?
So far I have been able to import a .as file, but I can't use addChild(). If I can get some help on how to do that I would be so grateful I have spent hours on end failing at this. 开发者_运维问答Thanks
create a class (in .as file) extending UIComponent
and use it as a root display object, add a creationComplete listener in the constructor and use it as an entry point.
and so the only mxml code you need is:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:loc="*"
xmlns:s="library://ns.adobe.com/flex/spark>
<loc:YourRootClass/>
</s:Application>
Recent versions of FlashBuilder allow for creation actionscript AIR project directly. If this isn't your case, just create new AIR MXML application, add new actionscript class and set it as default application. Then you can remove MXML. Also see this for details.
精彩评论