使用的Aptana插件开发AIR应用程序

转自:http://code.google.com/p/gwt4air/wiki/AirPlugin

AirPlugin  
Using the Aptana Plugin to develop AIR Application
Updated  May 22, 2011 by  jazzmata...@gmail.com

Normally this project is not about Java Script webdevelopement. But because of a user request i ll add a tutorial about using Aptana to develop AIR Application with the Ext-Air JS library.

Let s get started;

  • Download and install an eclipse distribution. I will wait in the meantime :).
  • Now that eclipse is installed you will need the Aptana Pluging for Eclipse. For that go to Help-> Install New Software

  • A new window should up. Please look for a button saying add new site.(That button has a differnet location based on which version of eclipse you have). After click of Add.. you get something like the next figure.
  • At some point in the installationprocess you will be prompted to restart the IDE. Select OK to restart.
  • If everything went well after the restart you should see the Aptana Dashboard
  • Now install install the Adobe AIR plugin for Aptana. For that click on Install Plugins on the dashboard. A list of available plugins should appear.Locate the AIR pluging entry and click on get it ( I actually needed to restart eclipse 2 times for the link to work)
  • The aptana support for Adobe AIR installation window should pup up.
Install it and restart eclipse.

  • Now that the AIR support is installed. Let s set up an AIR project
First change to the  Aptana Web view, then go to  File -> new -> others . Then type  Adobe in the textfield. Something like the next figure should appear.

  • Set up the project the way you like , but remember to not include any JS library include in Aptana. The following figure shows how my test project looks like.

  • As you can see Aptana has allreay set up a demo project for us. We will modify that project to include Ext-Air
  • Download Ext-Air from Sencha and copy the folder anywhere in your project. I copied mine in a folder named ext-air right at the root level of my application
  • Now modify the main HTML page to use Ext-Air
my HTML-page now looks like follow:

<html>
        <head>
        <title>Ext-Air with Aptana</title>
         <link rel="stylesheet" type="text/css" href="/ext-air/resources/extjs/ext-all.css" />
         <link rel="stylesheet" type="text/css" href="/lib/extair/resources/css/ext-air.css" />  
         <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
                 
         <script type="text/javascript" src="/ext-air/resources/extjs/adapter/ext/ext-base.js"></script>
          <script type="text/javascript" src="/ext-air/resources/extjs/ext-all.js"></script>
          <script type="text/javascript" src="/ext-air/ext-air-wo-xlayer.js"></script>
                  
        </head>
        
    </body>
</html>
  • Now let s add some Ext-Air code to the page.
     <script>
            Ext.onReady(function() {
                air.trace('sample');
                new Ext.air.Window({
                    win: window.nativeWindow, // use root window's context
                    html: 'Hello World'
                });
            });
        </script>
  • Before running the application, make sure that the application.xml file has the following entrry :
    <application xmlns="http://ns.adobe.com/air/application/1.5">

As you can see the aptana pluging ships with Adobe AIR 1.5. We will change it to use the latest release of AIR later on.

  • Now run the application by clicking on the run button. You should see something like the next figure.

  • To package the air application click on the Export Adobe AIR package button
  • If you want to run the application with the latest adobe AIR SDK instead of the one shiped with Aptana, please have a look at the setup.docfile in the download section.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值