9.2 定义应用程序描述文件的属性

定义应用程序描述文件的属性<o:p></o:p>

程序描述文件的根元素为application字段,其包含几个属性:<o:p></o:p>

<application appId="com.adobe.air.HelloWorld" version="1.0" <o:p></o:p>

    xmlns="http://ns.adobe.com/air/application/1.0.M4"> <o:p></o:p>

<o:p></o:p>

appID :程序唯一标识符,该属性可由下列字符组成:<o:p></o:p>

0-9 <o:p></o:p>

a-z <o:p></o:p>

A-Z <o:p></o:p>

. (点) <o:p></o:p>

- (横杆) <o:p></o:p>

该值必须包含17到255个字符。<o:p></o:p>

version :设定程序的版本信息<o:p></o:p>

xmlns :AIR名称空间,每个版本的AIR其名称空间都会不同。<o:p></o:p>

定义程序名称,标题,描述,版权和安装目录<o:p></o:p>

<o:p></o:p>

name :应用程序名称,必须定义<o:p></o:p>

<name>TestApp</name> <o:p></o:p>

<o:p></o:p>

在Windows中,这个值会显示在程序的标题栏中<o:p></o:p>

title (可选) :在AIR程序安装器中显示<o:p></o:p>

<title>TestApp from Adobe Systems Inc.</title> <o:p></o:p>

<o:p></o:p>

description (可选) AIR程序安装时显示<o:p></o:p>

<description>An MP3 player.</description> <o:p></o:p>

<o:p></o:p>

copyright (可选) AIR程序的版权信息<o:p></o:p>

<copyright>Copyright © 2006 [YourCompany, Inc.]</copyright> <o:p></o:p>

<o:p></o:p>

installFolder (可选) 默认安装目录的子目录<o:p></o:p>

<installFolder>Acme</installFolder> <o:p></o:p>

<o:p></o:p>

在Windows中,默认安装子目录为Program Files目录,在Mac OS中,为/Applications 目录。例如安装目录属性为"Acme"和程序名称为"ExampleApp",则程序将被安装在C:\Program Files\Acme\Example 。<o:p></o:p>

使用反斜杠(/) 作为目录分隔符:<o:p></o:p>

<installFolder>Acme/Power Tools</installFolder> <o:p></o:p>

<o:p></o:p>

installFolder属性可以包含任意Unicode (UTF-8) 字符,除了下面的:<o:p></o:p>

Character<o:p></o:p>

Hex Code<o:p></o:p>

various<o:p></o:p>

0x00 - x1F<o:p></o:p>

*<o:p></o:p>

x2A<o:p></o:p>

"<o:p></o:p>

x22<o:p></o:p>

:<o:p></o:p>

x3A<o:p></o:p>

><o:p></o:p>

x3C<o:p></o:p>

<<o:p></o:p>

x3E<o:p></o:p>

?<o:p></o:p>

x3F<o:p></o:p>

\<o:p></o:p>

x5C<o:p></o:p>

|<o:p></o:p>

x7C <o:p></o:p>

<o:p></o:p>

定义rootContent元素<o:p></o:p>

 <o:p></o:p>

Application.xml也指明了rootContent文件,因为这个文件是第一个被程序载入的。无论是SWF还是HTML文件。 <o:p></o:p>

rootContent元素值是一个URL,相对于application.xml文件所在路径,例如下面的rootContent 元素中AIRTunes.swf 文件和application.xml文件在同一个目录:<o:p></o:p>

<rootContent <o:p></o:p>

    systemChrome="none" <o:p></o:p>

    transparent="true" <o:p></o:p>

    visible="true" <o:p></o:p>

    height="400" <o:p></o:p>

    width="600"> <o:p></o:p>

        AIRTunes.swf <o:p></o:p>

</rootContent> <o:p></o:p>

<o:p></o:p>

rootContent元素的属性值主要设定将被创建的窗口的属性。<o:p></o:p>

systemChrome :如果设置为standard,窗口继承操作系统窗口样式,程序没有透明,如果设置为false,则窗口不继承操作系统窗口样式。当使用Flex WindowedApplication组件时,该组件将应用自己的窗口样式<o:p></o:p>

transparent :设置为true,则窗口支持Alpha混合,窗口被创建后transprent 属性将不可更改,透明的窗口需要更多内存且渲染速度慢。<o:p></o:p>

<o:p></o:p>

重要提示:当systemChrome="none"时你只能设置transparent="true"。<o:p></o:p>

visible :设置为false,使窗口创建后被隐藏。<o:p></o:p>

你可以需要在主窗口创建时先隐藏,等设置好位置和大小后,再通过stage.window.visible 属性设置为true.再显示主窗口。<o:p></o:p>

height, width :主窗口的高度和宽度。<o:p></o:p>

<o:p></o:p>

指定图标文件<o:p></o:p>

 <o:p></o:p>

Icon属性指定一个或多个可使用的图标文件,该属性是可选的,即使没有指定,操作系统会显示默认图标。<o:p></o:p>

图标路径是相对与程序的根目录,PNG, GIF, 和JPEG 格式都支持。<o:p></o:p>

<icon> <o:p></o:p>

    <image16x16>icons/smallIcon.png</image16x16> <o:p></o:p>

    <image32x32>icons/mediumIcon.jpg</image32x32> <o:p></o:p>

    <image48x48>icons/bigIcon.gif</image48x48> <o:p></o:p>

    <image128x128>icons/biggestIcon.png</image128x128>  <o:p></o:p>

</icon> <o:p></o:p>

<o:p></o:p>

注意:图标不会自动被添加到AIR包中。<o:p></o:p>

<o:p></o:p>

Signaling the inclusion of an update interface<o:p></o:p>

 <o:p></o:p>

一般情况,AIR 的安装和升级都是使用默认的安装对话框,但是,你可以定义自己的方法使用AIR Updater API来更新程序,要想这样,必须把handleUpdates 元素添加到描述文件中:<o:p></o:p>

<handleUpdates/> <o:p></o:p>

<o:p></o:p>

注册文件类型<o:p></o:p>

 <o:p></o:p>

fileTypes属性指定那些类型将被注册:<o:p></o:p>

<fileTypes> <o:p></o:p>

    <fileType> <o:p></o:p>

        <name>adobe.VideoFile</name> <o:p></o:p>

        <extension>avf</extension> <o:p></o:p>

        <description>Adobe Video File</description> <o:p></o:p>

        <contentType>application/vnd.adobe.video-file</contentType> <o:p></o:p>

    </fileType> <o:p></o:p>

</fileTypes> <o:p></o:p>

<o:p></o:p>

fileTypes元素是可选的。<o:p></o:p>

<o:p></o:p>

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值