Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7263447
  • 博文数量: 512
  • 博客积分: 12019
  • 博客等级: 上将
  • 技术积分: 6857
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-01 16:46
文章分类

全部博文(512)

文章存档

2024年(2)

2022年(2)

2021年(6)

2020年(59)

2019年(4)

2018年(10)

2017年(5)

2016年(2)

2015年(4)

2014年(4)

2013年(16)

2012年(47)

2011年(65)

2010年(46)

2009年(34)

2008年(52)

2007年(52)

2006年(80)

2005年(22)

分类:

2011-08-05 12:19:51

If you don’t know yet, you can publish your AS3 projects to run as Native Applications (.apk) on the Android OS (netbooks and phones). This article will show you how to use Adobe Flash CS5 Professional to create an application that runs on your Android device in 5 minutes.

Prerequisites:

  • Flash CS5 Professional (Download tria
  • l
  • AIR 2.5 runtime for Android Eclair or Froyo
  • AIR 2.5 SDK
  • The AIR for Android extension for Flash CS5
  • The Android SDK (download here)
  • An Android device (to test and debug your application on it, but it is not a must)

The AIR runtime, SDK for Android and the Android project extension for Flash CS5, are available on the Adobe Prerelease Program for now, so you will have to sign up for it and you can do it . Once you’re in you will be able to download them immediately.

Once you get the Android extension for Flash Professional, install it so you will be able to publish your creations as an Android Native application.

Now that you have these things set up, you can go ahead and open Flash CS5 Professional.

As you open it, you’ll find what’s on the image above. You’d go for the “AIR for Android” Template that now appears magically because of the extension you’ve just installed (or previously installed), which basically is an ActionScript 3 project but with AIR for Android publishing settings.

Now you’ve got a stage with generally the same dimensions of an Android device, however you are free to change the stage dimensions as it might vary from device to device. Here you go:

As you can see in this image, there is an additional edit button for “AIR Android Settings”. We will give a closer look to it later on.

Now let’s create some cool content on our stage. Some animation, some code… You can do whatever you want as it were an ordinary AIR application, just keep in mind that you will have to do some optimization as it is going to run on a phone and not a computer (of course you’ll do). For me, I’m just gonna put some cool “Hello World” TextField in the center of the stage, for the purposes of this demo.

You might want to add some Mouse Events, some glow effects or whatever you want. Once you are done test your project by hitting ctrl+enter (cmd+enter in Mac) and here you go your first Android content is living inside a SWF file wrapped inside the Flash Player. But it is not enough yet is it? We need to deploy this content as a native application on our Android device. So now connect your phone to your computer as I’m gonna show you some cool stuff.

Now select the stage and open the properties panel. Next to the “AIR Android Settings” click the “edit” button and you’ll see this panel.

Fill the fields as it is shown in the image.

The output file is the application you are going to deploy on the Android device. The application name is the name of the application (great explanation) and the app ID is an ID that the device recognize as a single application, which means if you install another app with the same ID of a previously installed app, it will replace it. Then go for the rest which is self explanatory.

Now go to the deployment tab. Where you will select a signing certificate (or create a new one) and enter its password, just like you would do in an ordinary AIR application for desktop.

Now we are going to debug the app directly on the device (in my case a Nexus One) so select “Device Debugging”, check the other the other two self explanatory options.

The last thing to do is to select the path of the adb file that you can find in the Android SDK I’ve been talking about above in the prerequisites. Click OK. We are not done yet! In order to debug on the device and receive console messages, we need to enable debugging on the device itself. So on the device go to “Settings > Applications > Development” and check “USB Debugging” and “Stay awake” (which won’t let your device auto lock). Note these settings are for Eclair and Froyo versions of Android (2.1 and 2.2).

Once you do this, on Flash go to the File menu and click on “Publish”, if everything is set right, you should get your application installed and running on the device. Of course you can test the minimal things on Device Central or just through the Flash Player instead of publishing to the phone every now and then. I’d personally  test on the device only device related actions such as dealing with the phone’s file system, touch activities etc.

And that’s it for now. Soon I’ll be posting how to do the same thing using Flash Builder with a Pure ActionScript 3 project.

Enjoy!

Omar.



其他参考:

阅读(8880) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~