简体   繁体   中英

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.

  1. Is that possible?
  2. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM