Back

白手起家学习使用flex (3) 使用Flash Builder5 完成第一个AIR项目

发布时间: 2011-11-25 10:47:00

按照前文  http://sg552.iteye.com/blog/1277793 ,我们安装好了Flash Builder 5, 下面开始第一个项目吧~!~~

( 根据 http://www.adobe.com/devnet/air/articles/getting_started_air_as.html
Follow these steps to start building your first ActionScript application on Adobe AIR:

Download the Adobe AIR runtime. You need the runtime to launch AIR applications.
Download and install your preferred development environment:
Adobe Flash Builder 4.5 (formerly Flex Builder)
Flex 4.5 SDK
Adobe Flash CS5.5 Professional  )
按照官方文档所说,要进行项目,需要:
1. Flash Professional CS5
2. Flash Builder
3. Flex SDK

所以,我们先下载着 Professional CS5 ,同时进行这篇文章的操作。 (这个东东是必须要用下载器下载的,速度很慢。我找不到连接)
如图:



然后,我们根据这个文档:
http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118676a28bd-8000.html 使用 Flash Builder建立第一个FLEX/AIR 项目。


过程非常简单:


建立好项目之后,是这样的:


修改第一个文件(flash_test2.mxml),内容是::

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx"
					   title="hihihihihi">
	<fx:Style> 
		@namespace s "library://ns.adobe.com/flex/spark"; 
		s|WindowedApplication 
		{ 
			
			skinClass:ClassReference("spark.skins.spark.SparkChromeWindowedApplicationSkin"); 
			background-color:#999999; 
			background-alpha:"0.9"; 
		}          
	</fx:Style>
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<s:Label text="Hello AIR1!!!!!! by siwei" horizontalCenter="10" verticalCenter="30"/> 
</s:WindowedApplication>


第二个文件(  flash_test2-app.xml)修改2处就好了:
		<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
		<systemChrome>none</systemChrome>

		<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
		<transparent>true</transparent>


然后,运行第二个文件( F11 或者 Run -> Debug. )就可以看到效果。 很简单。不截图了。

最后,导出!看看可以发布的AIR到底是啥东东。。。(第一篇日志中,使用命令行模式的 FLEX SDK 4.5 导出,失败。。。)

点击: project -> export release build..., signed AIR package


第一次导出的时候,需要提供一个认证文件(certificates file),没关系,按照说明一点点的创建它就好。



然后机会发现,项目文件夹下多了一个文件: flash_test2.air
双击它,就会安装。。。。

最后,它生成了2个文件:  exe 文件和 swf 文件。前者双击就可以在 windows 下运行~~~

Back