用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隐藏过滤条件
flash.display 

NativeWindow  - AS3

x

顶级
adobe.utils
air.desktop
air.net
air.update
air.update.events
coldfusion.air
coldfusion.air.errors
coldfusion.air.events
coldfusion.service
coldfusion.service.events
coldfusion.service.mxml
com.adobe.acm.solutions.authoring.domain.extensions
com.adobe.acm.solutions.ccr.domain.extensions
com.adobe.consulting.pst.vo
com.adobe.dct.component
com.adobe.dct.component.datadictionary
com.adobe.dct.component.datadictionaryElement
com.adobe.dct.component.dataElementsPanel
com.adobe.dct.component.toolbars
com.adobe.dct.event
com.adobe.dct.exp
com.adobe.dct.model
com.adobe.dct.service
com.adobe.dct.service.provider
com.adobe.dct.transfer
com.adobe.dct.util
com.adobe.dct.view
com.adobe.ep.taskmanagement.domain
com.adobe.ep.taskmanagement.event
com.adobe.ep.taskmanagement.filter
com.adobe.ep.taskmanagement.services
com.adobe.ep.taskmanagement.util
com.adobe.ep.ux.attachmentlist.component
com.adobe.ep.ux.attachmentlist.domain
com.adobe.ep.ux.attachmentlist.domain.events
com.adobe.ep.ux.attachmentlist.domain.renderers
com.adobe.ep.ux.attachmentlist.skin
com.adobe.ep.ux.attachmentlist.skin.renderers
com.adobe.ep.ux.content.event
com.adobe.ep.ux.content.factory
com.adobe.ep.ux.content.handlers
com.adobe.ep.ux.content.managers
com.adobe.ep.ux.content.model.asset
com.adobe.ep.ux.content.model.preview
com.adobe.ep.ux.content.model.relation
com.adobe.ep.ux.content.model.search
com.adobe.ep.ux.content.model.toolbar
com.adobe.ep.ux.content.search
com.adobe.ep.ux.content.services
com.adobe.ep.ux.content.services.load
com.adobe.ep.ux.content.services.permissions
com.adobe.ep.ux.content.services.preview
com.adobe.ep.ux.content.services.providers
com.adobe.ep.ux.content.services.query
com.adobe.ep.ux.content.services.relationships
com.adobe.ep.ux.content.services.search.lccontent
com.adobe.ep.ux.content.services.version
com.adobe.ep.ux.content.view
com.adobe.ep.ux.content.view.components.activate
com.adobe.ep.ux.content.view.components.grid
com.adobe.ep.ux.content.view.components.grid.hover
com.adobe.ep.ux.content.view.components.grid.hover.component
com.adobe.ep.ux.content.view.components.grid.renderers
com.adobe.ep.ux.content.view.components.relationships
com.adobe.ep.ux.content.view.components.review
com.adobe.ep.ux.content.view.components.search.renderers
com.adobe.ep.ux.content.view.components.searchpod
com.adobe.ep.ux.content.view.components.toolbar
com.adobe.ep.ux.content.view.components.toolbar.controlRenderers
com.adobe.ep.ux.content.view.components.version
com.adobe.ep.ux.documentsubmit.component
com.adobe.ep.ux.documentsubmit.domain
com.adobe.ep.ux.documentsubmit.skin
com.adobe.ep.ux.taskaction.component
com.adobe.ep.ux.taskaction.domain
com.adobe.ep.ux.taskaction.domain.events
com.adobe.ep.ux.taskaction.skin
com.adobe.ep.ux.taskdetails.component
com.adobe.ep.ux.taskdetails.domain
com.adobe.ep.ux.taskdetails.skin
com.adobe.ep.ux.tasklist.component
com.adobe.ep.ux.tasklist.domain
com.adobe.ep.ux.tasklist.skin
com.adobe.ep.ux.webdocumentviewer.domain
com.adobe.exm.expression
com.adobe.exm.expression.error
com.adobe.exm.expression.event
com.adobe.exm.expression.impl
com.adobe.fiber.runtime.lib
com.adobe.fiber.services
com.adobe.fiber.services.wrapper
com.adobe.fiber.styles
com.adobe.fiber.util
com.adobe.fiber.valueobjects
com.adobe.gravity.binding
com.adobe.gravity.context
com.adobe.gravity.flex.bundleloader
com.adobe.gravity.flex.progress
com.adobe.gravity.flex.serviceloader
com.adobe.gravity.framework
com.adobe.gravity.init
com.adobe.gravity.service.bundleloader
com.adobe.gravity.service.logging
com.adobe.gravity.service.manifest
com.adobe.gravity.service.progress
com.adobe.gravity.tracker
com.adobe.gravity.ui
com.adobe.gravity.utility
com.adobe.gravity.utility.async
com.adobe.gravity.utility.error
com.adobe.gravity.utility.events
com.adobe.gravity.utility.factory
com.adobe.gravity.utility.flex.async
com.adobe.gravity.utility.logging
com.adobe.gravity.utility.message
com.adobe.gravity.utility.sequence
com.adobe.gravity.utility.url
com.adobe.guides.control
com.adobe.guides.domain
com.adobe.guides.i18n
com.adobe.guides.spark.components.skins
com.adobe.guides.spark.components.skins.mx
com.adobe.guides.spark.headers.components
com.adobe.guides.spark.headers.skins
com.adobe.guides.spark.layouts.components
com.adobe.guides.spark.layouts.skins
com.adobe.guides.spark.navigators.components
com.adobe.guides.spark.navigators.renderers
com.adobe.guides.spark.navigators.skins
com.adobe.guides.spark.util
com.adobe.guides.spark.wrappers.components
com.adobe.guides.spark.wrappers.skins
com.adobe.guides.submit
com.adobe.icc.dc.domain
com.adobe.icc.dc.domain.factory
com.adobe.icc.editors.events
com.adobe.icc.editors.handlers
com.adobe.icc.editors.managers
com.adobe.icc.editors.model
com.adobe.icc.editors.model.config
com.adobe.icc.editors.model.el
com.adobe.icc.editors.model.el.operands
com.adobe.icc.editors.model.el.operators
com.adobe.icc.enum
com.adobe.icc.external.dc
com.adobe.icc.obj
com.adobe.icc.services
com.adobe.icc.services.category
com.adobe.icc.services.config
com.adobe.icc.services.download
com.adobe.icc.services.export
com.adobe.icc.services.external
com.adobe.icc.services.formbridge
com.adobe.icc.services.fragmentlayout
com.adobe.icc.services.layout
com.adobe.icc.services.letter
com.adobe.icc.services.locator
com.adobe.icc.services.module
com.adobe.icc.services.render
com.adobe.icc.services.submit
com.adobe.icc.services.user
com.adobe.icc.token
com.adobe.icc.vo
com.adobe.icc.vo.render
com.adobe.icomm.assetplacement.controller
com.adobe.icomm.assetplacement.controller.utils
com.adobe.icomm.assetplacement.data
com.adobe.icomm.assetplacement.model
com.adobe.livecycle.assetmanager.client
com.adobe.livecycle.assetmanager.client.event
com.adobe.livecycle.assetmanager.client.handler
com.adobe.livecycle.assetmanager.client.managers
com.adobe.livecycle.assetmanager.client.model
com.adobe.livecycle.assetmanager.client.model.cms
com.adobe.livecycle.assetmanager.client.service
com.adobe.livecycle.assetmanager.client.service.search
com.adobe.livecycle.assetmanager.client.service.search.cms
com.adobe.livecycle.assetmanager.client.utils
com.adobe.livecycle.content
com.adobe.livecycle.rca.model
com.adobe.livecycle.rca.model.constant
com.adobe.livecycle.rca.model.document
com.adobe.livecycle.rca.model.participant
com.adobe.livecycle.rca.model.reminder
com.adobe.livecycle.rca.model.stage
com.adobe.livecycle.rca.service
com.adobe.livecycle.rca.service.core
com.adobe.livecycle.rca.service.core.delegate
com.adobe.livecycle.rca.service.process
com.adobe.livecycle.rca.service.process.delegate
com.adobe.livecycle.rca.token
com.adobe.livecycle.ria.security.api
com.adobe.livecycle.ria.security.service
com.adobe.mosaic.layouts
com.adobe.mosaic.layouts.dragAndDrop
com.adobe.mosaic.layouts.interfaces
com.adobe.mosaic.mxml
com.adobe.mosaic.om.constants
com.adobe.mosaic.om.events
com.adobe.mosaic.om.impl
com.adobe.mosaic.om.interfaces
com.adobe.mosaic.skinning
com.adobe.mosaic.sparklib.editors
com.adobe.mosaic.sparklib.optionMenu
com.adobe.mosaic.sparklib.scrollableMenu
com.adobe.mosaic.sparklib.scrollableMenu.skins
com.adobe.mosaic.sparklib.tabLayout
com.adobe.mosaic.sparklib.tabLayout.events
com.adobe.mosaic.sparklib.tabLayout.layouts
com.adobe.mosaic.sparklib.tabLayout.skins
com.adobe.mosaic.sparklib.text
com.adobe.mosaic.sparklib.util
com.adobe.solutions.acm.authoring.presentation
com.adobe.solutions.acm.authoring.presentation.actionbar
com.adobe.solutions.acm.authoring.presentation.common
com.adobe.solutions.acm.authoring.presentation.events
com.adobe.solutions.acm.authoring.presentation.fragment
com.adobe.solutions.acm.authoring.presentation.letter
com.adobe.solutions.acm.authoring.presentation.letter.data
com.adobe.solutions.acm.authoring.presentation.preview
com.adobe.solutions.acm.authoring.presentation.rte
com.adobe.solutions.acm.ccr.presentation
com.adobe.solutions.acm.ccr.presentation.contentcapture
com.adobe.solutions.acm.ccr.presentation.contentcapture.events
com.adobe.solutions.acm.ccr.presentation.contentcapture.preview
com.adobe.solutions.acm.ccr.presentation.datacapture
com.adobe.solutions.acm.ccr.presentation.datacapture.renderers
com.adobe.solutions.acm.ccr.presentation.pdf
com.adobe.solutions.exm
com.adobe.solutions.exm.authoring
com.adobe.solutions.exm.authoring.components.controls
com.adobe.solutions.exm.authoring.components.toolbars
com.adobe.solutions.exm.authoring.domain
com.adobe.solutions.exm.authoring.domain.expression
com.adobe.solutions.exm.authoring.domain.impl
com.adobe.solutions.exm.authoring.domain.method
com.adobe.solutions.exm.authoring.domain.variable
com.adobe.solutions.exm.authoring.enum
com.adobe.solutions.exm.authoring.events
com.adobe.solutions.exm.authoring.model
com.adobe.solutions.exm.authoring.renderer
com.adobe.solutions.exm.authoring.view
com.adobe.solutions.exm.expression
com.adobe.solutions.exm.impl
com.adobe.solutions.exm.impl.method
com.adobe.solutions.exm.method
com.adobe.solutions.exm.mock
com.adobe.solutions.exm.mock.method
com.adobe.solutions.exm.runtime
com.adobe.solutions.exm.runtime.impl
com.adobe.solutions.exm.variable
com.adobe.solutions.prm.constant
com.adobe.solutions.prm.domain
com.adobe.solutions.prm.domain.factory
com.adobe.solutions.prm.domain.impl
com.adobe.solutions.prm.domain.manager
com.adobe.solutions.prm.presentation.asset
com.adobe.solutions.prm.presentation.constant
com.adobe.solutions.prm.presentation.document
com.adobe.solutions.prm.presentation.event
com.adobe.solutions.prm.presentation.file
com.adobe.solutions.prm.presentation.project
com.adobe.solutions.prm.presentation.team
com.adobe.solutions.prm.presentation.util
com.adobe.solutions.prm.service
com.adobe.solutions.prm.services.impl
com.adobe.solutions.prm.vo
com.adobe.solutions.rca.constant
com.adobe.solutions.rca.domain
com.adobe.solutions.rca.domain.common
com.adobe.solutions.rca.domain.factory
com.adobe.solutions.rca.domain.impl
com.adobe.solutions.rca.domain.impl.manager
com.adobe.solutions.rca.domain.manager
com.adobe.solutions.rca.presentation
com.adobe.solutions.rca.presentation.comment
com.adobe.solutions.rca.presentation.constant
com.adobe.solutions.rca.presentation.event
com.adobe.solutions.rca.presentation.gantt
com.adobe.solutions.rca.presentation.gantt.ruler
com.adobe.solutions.rca.presentation.template
com.adobe.solutions.rca.presentation.template.audit
com.adobe.solutions.rca.presentation.template.definition
com.adobe.solutions.rca.presentation.template.documents
com.adobe.solutions.rca.presentation.template.stages
com.adobe.solutions.rca.presentation.util
com.adobe.solutions.rca.service
com.adobe.solutions.rca.services.impl
com.adobe.solutions.rca.vo
com.adobe.solutions.rca.vo.um
com.adobe.viewsource
fl.accessibility
fl.containers
fl.controls
fl.controls.dataGridClasses
fl.controls.listClasses
fl.controls.progressBarClasses
fl.core
fl.data
fl.display
fl.events
fl.ik
fl.lang
fl.livepreview
fl.managers
fl.motion
fl.motion.easing
fl.rsl
fl.text
fl.transitions
fl.transitions.easing
fl.video
flash.accessibility
flash.concurrent
flash.crypto
flash.data
flash.desktop
flash.display
flash.display3D
flash.display3D.textures
flash.errors
flash.events
flash.external
flash.filesystem
flash.filters
flash.geom
flash.globalization
flash.html
flash.media
flash.net
flash.net.dns
flash.net.drm
flash.notifications
flash.permissions
flash.printing
flash.profiler
flash.sampler
flash.security
flash.sensors
flash.system
flash.text
flash.text.engine
flash.text.ime
flash.ui
flash.utils
flash.xml
flashx.textLayout
flashx.textLayout.compose
flashx.textLayout.container
flashx.textLayout.conversion
flashx.textLayout.edit
flashx.textLayout.elements
flashx.textLayout.events
flashx.textLayout.factory
flashx.textLayout.formats
flashx.textLayout.operations
flashx.textLayout.utils
flashx.undo
ga.controls
ga.layouts
ga.model
ga.uiComponents
ga.util
ga.views
ga.wrappers
lc.foundation
lc.foundation.domain
lc.foundation.events
lc.foundation.ui
lc.foundation.util
lc.preloader
lc.procmgmt
lc.procmgmt.commands
lc.procmgmt.domain
lc.procmgmt.events
lc.procmgmt.formbridge
lc.procmgmt.impl
lc.procmgmt.ui.attachments
lc.procmgmt.ui.controls
lc.procmgmt.ui.controls.card
lc.procmgmt.ui.controls.renderer
lc.procmgmt.ui.help
lc.procmgmt.ui.layout
lc.procmgmt.ui.presentationmodel
lc.procmgmt.ui.process
lc.procmgmt.ui.search
lc.procmgmt.ui.startpoint
lc.procmgmt.ui.task
lc.procmgmt.ui.task.form
lc.procmgmt.ui.task.form.commands
lc.procmgmt.ui.tracking
mx.accessibility
mx.automation
mx.automation.air
mx.automation.delegates
mx.automation.delegates.advancedDataGrid
mx.automation.delegates.charts
mx.automation.delegates.containers
mx.automation.delegates.controls
mx.automation.delegates.controls.dataGridClasses
mx.automation.delegates.controls.fileSystemClasses
mx.automation.delegates.core
mx.automation.delegates.flashflexkit
mx.automation.events
mx.binding
mx.binding.utils
mx.charts
mx.charts.chartClasses
mx.charts.effects
mx.charts.effects.effectClasses
mx.charts.events
mx.charts.renderers
mx.charts.series
mx.charts.series.items
mx.charts.series.renderData
mx.charts.styles
mx.collections
mx.collections.errors
mx.containers
mx.containers.accordionClasses
mx.containers.dividedBoxClasses
mx.containers.errors
mx.containers.utilityClasses
mx.controls
mx.controls.advancedDataGridClasses
mx.controls.dataGridClasses
mx.controls.listClasses
mx.controls.menuClasses
mx.controls.olapDataGridClasses
mx.controls.scrollClasses
mx.controls.sliderClasses
mx.controls.textClasses
mx.controls.treeClasses
mx.controls.videoClasses
mx.core
mx.core.windowClasses
mx.data
mx.data.crypto
mx.data.errors
mx.data.events
mx.data.messages
mx.data.mxml
mx.data.offline.errors
mx.data.utils
mx.effects
mx.effects.easing
mx.effects.effectClasses
mx.events
mx.filters
mx.flash
mx.formatters
mx.geom
mx.graphics
mx.graphics.codec
mx.graphics.shaderClasses
mx.logging
mx.logging.errors
mx.logging.targets
mx.managers
mx.messaging
mx.messaging.channels
mx.messaging.config
mx.messaging.errors
mx.messaging.events
mx.messaging.management
mx.messaging.messages
mx.modules
mx.netmon
mx.olap
mx.olap.aggregators
mx.preloaders
mx.printing
mx.resources
mx.rpc
mx.rpc.events
mx.rpc.http
mx.rpc.http.mxml
mx.rpc.livecycle
mx.rpc.mxml
mx.rpc.remoting
mx.rpc.remoting.mxml
mx.rpc.soap
mx.rpc.soap.mxml
mx.rpc.wsdl
mx.rpc.xml
mx.skins
mx.skins.halo
mx.skins.spark
mx.skins.wireframe
mx.skins.wireframe.windowChrome
mx.states
mx.styles
mx.utils
mx.validators
org.osmf.containers
org.osmf.display
org.osmf.elements
org.osmf.events
org.osmf.layout
org.osmf.logging
org.osmf.media
org.osmf.metadata
org.osmf.net
org.osmf.net.dvr
org.osmf.net.httpstreaming
org.osmf.net.metrics
org.osmf.net.qos
org.osmf.net.rtmpstreaming
org.osmf.net.rules
org.osmf.traits
org.osmf.utils
spark.accessibility
spark.automation.delegates
spark.automation.delegates.components
spark.automation.delegates.components.gridClasses
spark.automation.delegates.components.mediaClasses
spark.automation.delegates.components.supportClasses
spark.automation.delegates.skins.spark
spark.automation.events
spark.collections
spark.components
spark.components.calendarClasses
spark.components.gridClasses
spark.components.mediaClasses
spark.components.supportClasses
spark.components.windowClasses
spark.core
spark.effects
spark.effects.animation
spark.effects.easing
spark.effects.interpolation
spark.effects.supportClasses
spark.events
spark.filters
spark.formatters
spark.formatters.supportClasses
spark.globalization
spark.globalization.supportClasses
spark.layouts
spark.layouts.supportClasses
spark.managers
spark.modules
spark.preloaders
spark.primitives
spark.primitives.supportClasses
spark.skins
spark.skins.mobile
spark.skins.mobile.supportClasses
spark.skins.spark
spark.skins.spark.mediaClasses.fullScreen
spark.skins.spark.mediaClasses.normal
spark.skins.spark.windowChrome
spark.skins.wireframe
spark.skins.wireframe.mediaClasses
spark.skins.wireframe.mediaClasses.fullScreen
spark.transitions
spark.utils
spark.validators
spark.validators.supportClasses
xd.core.axm.enterprise.view.components
xd.core.axm.enterprise.view.skins
xd.core.axm.view.components
xd.core.axm.view.components.support

语言元素

全局常量
全局函数
运算符
语句、关键字和指令
特殊类型

附录

新增内容
编译器错误
编译器警告
运行时错误
迁移到 ActionScript 3
支持的字符集
仅适用于 MXML 的标签
Motion XML 元素
Timed Text 标记
不推荐使用的元素的列表
AccessibilityImplementation 常量
如何使用 ActionScript 示例
法律声明
flash.display
public class NativeWindow
继承NativeWindow Inheritance EventDispatcher Inheritance Object

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

NativeWindow 类提供一个接口,用于创建和控制本机桌面窗口。

AIR 配置文件支持:所有桌面操作系统均支持此功能,但移动设备或 AIR for TV 设备不支持此功能。您可以使用 NativeWindow.isSupported 属性测试桌面设备上是否支持运行时。有关在多个配置文件之间支持 API 的详细信息,请参阅 AIR 配置文件支持

对 NativeWindow 实例的引用由 window 构造函数返回。也可以使用该窗口的舞台上的任何显示对象的 stage.nativeWindow 属性来访问对 NativeWindow 实例的引用。

var window:NativeWindow = displayObject.stage.nativeWindow;

NativeWindow 实例的属性只能由应用程序内容访问。如果非应用程序内容尝试访问 NativeWindow 对象,则将引发安全错误。

可以使用 Stage 对象的 DisplayObjectContainer 方法(如 addChild())将内容添加到窗口中。

不能将 Flex 组件直接添加到 NativeWindow 实例的显示列表中。而应使用 Flex mx:WindowedApplication 和 mx:Window 组件创建窗口并将其他 Flex 组件添加为上述对象的子项。可以将基于 Flex 的 SWF 内容直接添加到 NativeWindow 窗口,只要该 SWF 文件已加载到自己的应用程序域中并且是应用程序内容。

要创建根 HTML 窗口以显示 HTML 内容,使用 HTMLLoader.createRootWindow() 创建该窗口通常更容易些。以此方式创建的窗口将会自动添加 HTMLLoader 对象。(也可以从 JavaScript 中使用 JavaScript window.open() 函数。不过,此方法对窗口外观和行为的控制能力较差。)

下面对 NativeWindow 对象的操作是异步执行的:close()maximize()minimize()restore()bounds 更改。应用程序可以通过侦听相应的事件来检测这些操作何时完成。

如果 NativeApplication.autoExit 属性为默认值 true,则当应用程序的最后一个窗口关闭时,应用程序也将关闭(并且所有 close 事件处理函数均已返回)。如果 autoExitfalse,则必须调用 NativeApplication.nativeApplication.exit() 才能终止应用程序。

在调用 window 构造函数之后和调用 close() 之前,不会对 NativeWindow 对象进行垃圾回收。应用程序负责关闭其自己的窗口。

相关 API 元素



公共属性
 属性由以下参数定义
      active : Boolean
[只读] 表示此窗口是否为活动应用程序窗口。
NativeWindow
      alwaysInFront : Boolean
指定此窗口是否始终显示在其他窗口前面(包括其他应用程序的窗口)。
NativeWindow
      bounds : Rectangle
此窗口的大小和位置。
NativeWindow
      closed : Boolean
[只读] 表示此窗口是否已关闭。
NativeWindow
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
      displayState : String
[只读] 此窗口的显示状态。
NativeWindow
      height : Number
此窗口的高度(以像素为单位)。
NativeWindow
      isSupported : Boolean
[静态] [只读] 表示客户端系统上是否支持本机窗口。
NativeWindow
      maximizable : Boolean
[只读] 报告用于创建此窗口的可最大化设置。
NativeWindow
      maxSize : Point
此窗口的最大大小。
NativeWindow
      menu : NativeMenu
此窗口的本机菜单。
NativeWindow
      minimizable : Boolean
[只读] 报告用于创建此窗口的可最小化设置。
NativeWindow
      minSize : Point
此窗口的最小大小。
NativeWindow
      owner : NativeWindow
[只读] 拥有此窗口的 NativeWindow 对象。
NativeWindow
      renderMode : String
[只读] 报告用于创建此窗口的窗口 renderMode 设置。
NativeWindow
      resizable : Boolean
[只读] 报告用于创建此窗口的可调整大小设置。
NativeWindow
      stage : Stage
[只读] 此窗口的 Stage 对象。
NativeWindow
      supportsMenu : Boolean
[静态] [只读] 表示 AIR 是否在当前计算机系统上支持本机窗口菜单。
NativeWindow
      supportsNotification : Boolean
[静态] [只读] 表示 AIR 是否在当前计算机系统上支持窗口通知提示。
NativeWindow
      supportsTransparency : Boolean
[静态] [只读] 表示 AIR 是否支持具有透明像素的本机窗口。
NativeWindow
      systemChrome : String
[只读] 报告用于创建此窗口的系统镶边设置。
NativeWindow
      systemMaxSize : Point
[静态] [只读] 操作系统允许的最大窗口大小。
NativeWindow
      systemMinSize : Point
[静态] [只读] 操作系统允许的最小窗口大小。
NativeWindow
      title : String
窗口标题。
NativeWindow
      transparent : Boolean
[只读] 报告用于创建此窗口的透明度设置。
NativeWindow
      type : String
[只读] 报告用于创建此窗口的窗口类型设置。
NativeWindow
      visible : Boolean
指定此窗口是否可见。
NativeWindow
      width : Number
此窗口的宽度(以像素为单位)。
NativeWindow
      x : Number
此窗口的左上角相对于操作系统桌面原点的水平轴坐标。
NativeWindow
      y : Number
此窗口的左上角相对于操作系统桌面左上角的垂直轴坐标。
NativeWindow
公共方法
 方法由以下参数定义
  
创建新的 NativeWindow 实例和相应的操作系统窗口。
NativeWindow
  
    activate():void
激活此窗口。
NativeWindow
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
  
    close():void
关闭此窗口。
NativeWindow
 Inherited
将事件调度到事件流中。
EventDispatcher
  
    globalToScreen(globalPoint:Point):Point
将像素坐标中相对于窗口舞台原点(就显示列表而言为全局点)转换为虚拟桌面上的点。
NativeWindow
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
  
返回此窗口所拥有的 NativeWindow 对象的列表。
NativeWindow
  
    maximize():void
使此窗口最大化。
NativeWindow
  
    minimize():void
使此窗口最小化。
NativeWindow
  
    notifyUser(type:String):void
通过操作系统触发可视提示:发生了需要关注的事件。
NativeWindow
  
将此窗口放在紧靠指定窗口后面。
NativeWindow
  
将此窗口放在紧靠指定窗口前面。
NativeWindow
  
将此窗口放在任何其他可见窗口后面。
NativeWindow
  
将此窗口放在任何其他可见窗口前面。
NativeWindow
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
  
    restore():void
从最小化或最大化状态还原此窗口。
NativeWindow
 Inherited
设置循环操作动态属性的可用性。
Object
  
    startMove():Boolean
启动此窗口的系统控制移动。
NativeWindow
  
    startResize(edgeOrCorner:String = "BR"):Boolean
启动此窗口的系统控制调整大小操作。
NativeWindow
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
 Inherited
检查是否用此 EventDispatcher 对象或其任何祖代为指定事件类型注册了事件侦听器。
EventDispatcher
事件
 事件 摘要 由以下参数定义
  
    activate
在激活窗口后由此 NativeWindow 对象调度。NativeWindow
  
    close
在关闭窗口后由此 NativeWindow 对象调度。NativeWindow
  
    closing
在关闭窗口的前一刻由此 NativeWindow 对象调度。NativeWindow
  
    deactivate
在取消激活窗口后由此 NativeWindow 对象调度。NativeWindow
  在窗口的 displayState 属性更改后由此 NativeWindow 对象调度。NativeWindow
  在窗口更改其显示状态的前一刻由此 NativeWindow 对象调度。NativeWindow
  
    move
在桌面上移动窗口后由此 NativeWindow 对象调度。NativeWindow
  
    moving
在桌面上移动窗口的前一刻由此 NativeWindow 对象调度。NativeWindow
  
    resize
在调整窗口大小后由此 NativeWindow 对象调度。NativeWindow
  
    resizing
在桌面上调整窗口大小的前一刻由此 NativeWindow 对象调度。NativeWindow
属性详细信息
    

active

属性
active:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

表示此窗口是否为活动应用程序窗口。

使用 activate() 方法可使窗口处于活动状态。



实现
    public function get active():Boolean

相关 API 元素

    

alwaysInFront

属性 
alwaysInFront:Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

指定此窗口是否始终显示在其他窗口前面(包括其他应用程序的窗口)。

沿系统深度顺序有两组窗口。位于 alwaysInFront 组中的窗口始终显示在所有其他窗口的前面。同一组内的窗口之间的深度顺序按常规确定。换句话说,激活一个窗口会将该窗口置于其组内的其他窗口前面。

alwaysInFrontfalse 更改为 true 会将该窗口置于所有其他窗口的前面。将该属性从 true 更改为 false 会将该窗口置于“alwaysInFront”窗口的后面,但仍位于其他窗口前面。将该属性设置为其当前值不会更改该窗口的深度顺序。设置具有所有者的窗口的 alwaysInFront 属性没有效果。

应该尽量少将 alwaysInFront 设置为 true,因为使用此设置的窗口将出现在其他应用程序的窗口之前,即使其他应用程序处于活动状态时也是如此。

操作系统行为注意事项:

  • 某些 Linux 窗口管理器不会在全屏窗口的前面显示 alwaysInFront 属性设置为 的窗口。
  • 在 Mac® OS X 中,如果窗口舞台的 displayState 属性为 fullScreenfullScreenInteractive,将 alwaysInFront 设置为 true 将不起作用。



实现
    public function get alwaysInFront():Boolean
    public function set alwaysInFront(value:Boolean):void

示例  ( 如何使用本示例 )
下列示例强制将某个窗口显示在其他所有窗口(这些窗口不受类似的强制)前面:
windowObj.alwaysInFront = true;
使用对窗口舞台上的显示对象的引用:
displayObject.stage.nativeWindow.alwaysInFront=true;
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.alwaysInFront = true;
    

bounds

属性 
bounds:Rectangle

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的大小和位置。

窗口尺寸包括任何系统镶边。窗口舞台的尺寸等于窗口尺寸减去任何系统镶边的大小。更改窗口的宽度和高度将更改舞台的 stageWidthstageHeight。反之亦然:更改舞台尺寸也将更改窗口大小。

在根 HTML 窗口中,outerWidthouterHeight 属性等同于窗口的 heightwidth 属性。innerWidthinnerHeight 属性等于 stage.stageWidthstage.stageHeight 属性减去该窗口显示的任何滚动条的粗细。

每当此窗口的宽度或高度更改时即调度 resize 事件。同样,每当此窗口的原点 (x,y) 更改时即调度 move 事件。在 Mac OS 和 Windows 上,直接设置 bounds 属性不会调度 movingresizing 事件。但在 Linux 上,设置 bounds 属性时,NativeWindow 会调度 movingresizing 事件。

设置窗口的 bounds 属性等效于设置其 xywidthheight 属性。同样,设置任何单个尺寸等效于设置 bounds 属性。使用 bounds 属性同时设置所有尺寸时,调度的事件会较少。

无法保证设置各个尺寸的顺序。在不允许窗口扩大到桌面区域之外的 Linux 窗口管理器中,即使应用所有属性更改的最终效果会产生合法的窗口,也可能会阻止对单个属性的更改。

如果指定的宽度或高度小于允许的最小值或大于允许的最大值,则会将窗口宽度或高度设置为最接近的合法大小。决定宽度和高度的最小值和最大值的因素包括以下这些:

  • NativeWindow 对象的 minSize 属性和 maxSize 属性
  • 操作系统的最小限值和最大限值,即 NativeWindow.systemMinSizeNativeWindow.systemMaxSize 的值。
  • 在 Adobe AIR 中,窗口的最大宽度和高度均为 4095 像素。(在 AIR 1.5 及早期版本中,窗口宽度和高度的最大值都是 2880 像素。)
  • 任何显示的系统镶边需要的最小宽度和高度。

当窗口的位置或尺寸更改时,像素值将舍入为最近的整数。



实现
    public function get bounds():Rectangle
    public function set bounds(value:Rectangle):void

引发
ArgumentError — 如果矩形为空或包含无效值。
 
IllegalOperationError — 如果在关闭此窗口后访问 bounds 属性。

相关 API 元素


示例  ( 如何使用本示例 )
下面的示例使用对 NativeWindow 对象的引用设置窗口的范围:
windowObj.bounds = new Rectangle(200, 200, 1000, 800);
使用对窗口舞台上的显示对象的引用:
displayObject.stage.nativeWindow.bounds = new Rectangle(20, 20, 800, 600);
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.bounds = new air.Rectangle(20, 20, 800, 600);
    

closed

属性 
closed:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

表示此窗口是否已关闭。

对已关闭的窗口访问以下属性将引发非法操作错误:

  • title
  • bounds
  • xywidthheight
  • displayState
  • visible

同样,对已关闭的窗口调用以下方法也将引发非法操作错误:

  • minimize()
  • maximize()
  • restore()
  • startResize()
  • startMove()



实现
    public function get closed():Boolean

示例  ( 如何使用本示例 )
下列示例演示如何访问窗口的 closed 属性:
var isWindowClosed:Boolean = windowObj.closed;
使用对窗口舞台上的显示对象的引用:
var isWindowClosed:Boolean = displayObject.stage.nativeWindow.closed;
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
var isWindowClosed = window.nativeWindow.closed;
    

displayState

属性 
displayState:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的显示状态。

用作可能值的常量在 NativeWindowDisplayState 类中定义:

  • NativeWindowDisplayState.NORMAL
  • NativeWindowDisplayState.MINIMIZED
  • NativeWindowDisplayState.MAXIMIZED



实现
    public function get displayState():String

引发
IllegalOperationError — 如果在关闭此窗口后访问 displayState 属性。

相关 API 元素


示例  ( 如何使用本示例 )
下面的示例显示如何在给定一个对窗口对象的引用的情况下获取当前窗口的显示状态:
var state:String = windowObj.displayState;
    

height

属性 
height:Number

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的高度(以像素为单位)。

窗口的尺寸包括显示的任何系统窗口镶边。可以从 Stage.stageHeight 属性获取窗口内部可用的显示区域高度。

更改窗口的 height 属性等效于通过 bounds 属性更改高度。

如果指定高度小于允许的最小值或大于允许的最大值,则会将窗口高度设置为最接近的合法大小。决定高度的最小值和最大值的因素包括以下这些:

  • NativeWindow 对象的 minSize.x 和属性 maxSize.x 属性
  • 操作系统的最小限值和最大限值,即 NativeWindow.systemMinSize.xNativeWindow.systemMaxSize.x 的值。
  • 在 Adobe AIR 中,窗口高度的最大值是 4095 像素(在 AIR 1.5 及早期版本中是 2880 像素)。

在 Linux 上,设置 height 属性是一种异步操作。

要检测高度更改是否完成,请侦听 resize 事件,所有平台上都会调度该事件。

当窗口的高度更改时,像素值将舍入为最近的整数。



实现
    public function get height():Number
    public function set height(value:Number):void

引发
ArgumentError — 如果设置的值为 null 或无效。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

isSupported

属性 
isSupported:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 2.0

表示客户端系统上是否支持本机窗口。



实现
    public static function get isSupported():Boolean
    

maximizable

属性 
maximizable:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的可最大化设置。

创建窗口后,不能更改 maximizable 设置。

注意:即使在 maximizable 属性设置为 false 时,某些 Linux 窗口管理器也允许用户最大化窗口。



实现
    public function get maximizable():Boolean

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

maxSize

属性 
maxSize:Point

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的最大大小。

大小限制指定为 Point 对象的坐标。点的 x 属性对应于窗口宽度,y 属性对应于窗口高度。

对通过 ActionScript 代码和操作系统调用的窗口大小调整操作强制实施 maxSize 限制。

如果窗口的当前范围大于新的最大大小,则设置 maxSize 将更改窗口的范围。

如果指定的宽度或高度大于允许的最大值,则会将窗口的宽度或高度设置为最接近的合法大小。决定宽度和高度的最小值和最大值的因素包括以下这些:

  • 操作系统的最大限值,即 NativeWindow.systemMaxSize 的值。
  • 在 Adobe AIR 中,窗口的最大宽度和高度均为 4095 像素。(在 AIR 1.5 及早期版本中,窗口宽度和高度的最大值都是 2880 像素。)

注意:在某些操作系统(如 Mac OS X)中,即使最大化后的窗口将小于操作系统屏幕,将窗口最大化也只能使窗口扩大至 maxSize 值。该窗口将仍然处于最大化显示状态。



实现
    public function get maxSize():Point
    public function set maxSize(value:Point):void

引发
IllegalOperationError — 如果分配的大小不在操作系统的最小和最大窗口大小范围之内。
 
SecurityError — 如果因为内容的当前权限而禁止该大小。
 
ArgumentError — 如果该大小为 null 或包含无效值。
 
IllegalOperationError — 如果在关闭此窗口后访问 maxSize 属性。

相关 API 元素


示例  ( 如何使用本示例 )
下面的示例显示如何为窗口设置允许的最大大小。
windowObj.maxSize = new Point(1040,920);
使用对窗口舞台上的显示对象的引用:
displayObject.stage.nativeWindow.maxSize = new Point(800,600);
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.maxSize = new air.Point(960,960);
    

menu

属性 
menu:NativeMenu

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的本机菜单。

在将 NativeMenu 对象分配给窗口的 menu 属性时,如果 NativeWindow.supportsMenutrue,将为窗口显示一个本机菜单,除非该窗口的 systemChrome 属性为 NativeWindowSystemChrome.NONE

注意:允许在 NativeWindow.supportsMenufalse 或窗口的 systemChrome 属性为 NativeWindowSystemChrome.NONE 时为窗口分配菜单,但不执行任何操作。务必使用 NativeWindow.supportsMenu 属性来确定操作系统是否支持窗口菜单。使用其他方法(如 Capabilities.os)确定支持情况可能导致编程错误(如果没有考虑到某些可行的目标操作系统)。



实现
    public function get menu():NativeMenu
    public function set menu(value:NativeMenu):void

相关 API 元素

    

minimizable

属性 
minimizable:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的可最小化设置。

创建窗口后,不能更改 minimizable 设置。

注意:即使在 minimizable 属性设置为 false 时,某些 Linux 窗口管理器也允许用户最小化窗口。



实现
    public function get minimizable():Boolean

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

minSize

属性 
minSize:Point

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的最小大小。

大小限制指定为 Point 对象的坐标。点的 x 属性对应于窗口宽度,y 属性对应于窗口高度。

如果窗口的当前范围小于新的最小大小,则设置 minSize 将更改窗口的范围。

对通过 ActionScript 代码和操作系统调用的窗口大小调整操作强制实施 minSize 限制。

注意:显示的任何系统镶边的宽度和高度可能使得无法将窗口设置得与指定的最小大小一样小。



实现
    public function get minSize():Point
    public function set minSize(value:Point):void

引发
IllegalOperationError — 如果分配的大小不在操作系统的最小和最大窗口大小范围之内。
 
SecurityError — 如果因为内容的当前权限而禁止该大小。
 
ArgumentError — 如果该大小为 null 或包含无效值。
 
IllegalOperationError — 如果在关闭此窗口后访问 minSize 属性。

相关 API 元素


示例  ( 如何使用本示例 )
下面的示例演示如何为窗口设置允许的最小大小:
windowObj.minSize = new Point(200,80);
使用对窗口舞台上的显示对象的引用:
displayObject.stage.nativeWindow.minSize = new Point(120,60);
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.minSize = new air.Point(80,60);
    

owner

属性 
owner:NativeWindow  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 2.6

拥有此窗口的 NativeWindow 对象。

窗口所有权是在创建窗口时建立的,不能更改。要创建具有所有者的窗口,请将拥有的 NativeWindow 对象设置为用于创建所拥有窗口的 NativeWindowInitOptions 对象的 owner 属性。

注意:在 Linux 上,当所有者处于全屏模式时,有些窗口管理器不在拥有窗口前面显示所拥有的窗口。



实现
    public function get owner():NativeWindow

相关 API 元素

    

renderMode

属性 
renderMode:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 3.0

报告用于创建此窗口的窗口 renderMode 设置。

NativeWindow.renderMode 返回的值将是在 NativeWindowRenderMode 类中定义的常量之一。

创建窗口后,不能更改 renderMode 设置。



实现
    public function get renderMode():String

引发
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

resizable

属性 
resizable:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的可调整大小设置。

创建窗口后,不能更改 resizable 设置。



实现
    public function get resizable():Boolean

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

stage

属性 
stage:Stage  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的 Stage 对象。Stage 对象是基于 ActionScript 3.0 的 SWF 内容中使用的显示列表体系结构中的根对象。

舞台是窗口显示列表的根。通过将可视显示对象添加到舞台或添加到此舞台的显示列表中已有的另一个对象来将可视显示对象添加到窗口。舞台尺寸是在窗口使用系统镶边时窗口客户端区域的尺寸。如果不使用系统镶边,舞台尺寸等于窗口尺寸。



实现
    public function get stage():Stage

相关 API 元素


示例  ( 如何使用本示例 )
下面的示例显示如何为 NativeWindow 实例设置舞台属性:
import flash.display.StageAlign;

windowObj.stage.align = StageAlign.TOP_LEFT;
    

supportsMenu

属性 
supportsMenu:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

表示 AIR 是否在当前计算机系统上支持本机窗口菜单。

如果 NativeWindow.supportsMenutrue,则在将 NativeMenu 对象分配给窗口的 menu 属性时,将为该窗口显示本机菜单(除非该窗口的 systemChrome 属性为 NativeWindowSystemChrome.NONE)。务必使用 NativeWindow.supportsMenu 属性来确定操作系统是否支持本机窗口菜单。使用其他方法(如 Capabilities.os)确定支持情况可能导致编程错误(如果没有考虑到某些可行的目标操作系统)。

注意:允许在 NativeWindow.supportsMenufalse 或窗口的 systemChrome 属性为 NativeWindowSystemChrome.NONE 时为窗口分配菜单,但不执行任何操作。



实现
    public static function get supportsMenu():Boolean

相关 API 元素

    

supportsNotification

属性 
supportsNotification:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

表示 AIR 是否在当前计算机系统上支持窗口通知提示。

如果 NativeWindow.supportsNotificationtrue,则调用该窗口的 notifyUser() 方法将向用户显示一个可视提示,提示用户发生了需要关注的事件。此可视提示将遵循本机系统的操作系统约定。例如在 Windows®中,任务栏图标将闪烁。

注意:允许在 NativeWindow.supportsNotificationfalse 时调用 notifyUser(),但不执行任何操作。



实现
    public static function get supportsNotification():Boolean

相关 API 元素

    

supportsTransparency

属性 
supportsTransparency:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.1

表示 AIR 是否支持具有透明像素的本机窗口。

NativeWindow.supportsTransparencytrue,若窗口 transparent 属性设为 true,将保留本机窗口的像素的透明度。若 NativeWindow.supportsTransparencyfalse,则无论窗口 transparent 属性为何值,所有像素的不透明度都将设为 1。当 NativeWindow.supportsTransparencyfalse 时,完全透明的像素将呈现为黑色。务必使用 NativeWindow.supportsTransparency 属性来确定操作系统是否支持透明度。使用其他方法(如 Capabilities.os)确定支持情况可能导致编程错误(如果没有考虑到某些可行的目标操作系统)。

注意:根据为操作系统设置的用户首选项的不同,在应用程序运行过程中,此属性的值可能会发生变化。



实现
    public static function get supportsTransparency():Boolean

相关 API 元素

    

systemChrome

属性 
systemChrome:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的系统镶边设置。

NativeWindow.systemChrome 返回的值将是在 NativeWindowSystemChrome 类中定义的常量之一。

创建窗口后,不能更改系统镶边设置。



实现
    public function get systemChrome():String

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素


示例  ( 如何使用本示例 )
以下示例说明了如何获得窗口的系统镶边类型:
var sysChromeType:String = windowObj.systemChrome;
使用对窗口舞台上的显示对象的引用:
var sysChromeType:String = displayObject.stage.nativeWindow.systemChrome;
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
var sysChromeType = window.nativeWindow.systemChrome;
下面的示例显示如何通过创建一个新窗口并将所有子级显示对象移动到该新窗口来更改系统外观镶边和透明度设置:
import flash.display.NativeWindow;
import flash.display.NativeWindowSystemChrome;
import flash.display.NativeWindowInitOptions;

public function deChromeWindow(oldWindow:NativeWindow):NativeWindow{
    if(oldWindow.systemChrome != NativeWindowSystemChrome.NONE){
        var newOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
        newOptions.systemChrome = NativeWindowSystemChrome.NONE;
        newOptions.transparent = true;
        
        var newWindow:NativeWindow = new NativeWindow(newOptions);
        newWindow.stage.stageWidth = oldWindow.stage.stageWidth;
        newWindow.stage.stageHeight = oldWindow.stage.stageHeight;
        newWindow.stage.align = oldWindow.stage.align;
        newWindow.stage.scaleMode = oldWindow.stage.scaleMode;
        
        for(var i:int = 0; i < oldWindow.stage.numChildren; i++){
            newWindow.stage.addChild(oldWindow.stage.getChildAt(i));
        }
        newWindow.activate();
        oldWindow.close();
        
        return newWindow;
    }
    return oldWindow;
}

    

systemMaxSize

属性 
systemMaxSize:Point  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

操作系统允许的最大窗口大小。

大小限制指定为 Point 对象的坐标。点的 x 属性对应于窗口宽度,y 属性对应于窗口高度。

除了操作系统大小限制,AIR 将窗口大小的最大值限制为 4095 x 4095 像素(在 AIR 1.5 及早期版本中限制为 2880 x 2880 像素)。此外,应用程序可以使用 NativeWindow 对象的 maxSize 属性来设置限值。



实现
    public static function get systemMaxSize():Point
    

systemMinSize

属性 
systemMinSize:Point  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

操作系统允许的最小窗口大小。

大小限制指定为 Point 对象的坐标。点的 x 属性对应于窗口宽度,y 属性对应于窗口高度。



实现
    public static function get systemMinSize():Point
    

title

属性 
title:String

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

窗口标题。

该标题将出现在该窗口的系统镶边中(如果显示系统镶边),也会出现在与系统相关的其他位置(如任务栏)。



实现
    public function get title():String
    public function set title(value:String):void

引发
IllegalOperationError — 如果在关闭此窗口后访问该属性。

示例  ( 如何使用本示例 )
下面的示例设置窗口对象的标题:
windowObj.title = "Window Title";
    

transparent

属性 
transparent:Boolean  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的透明度设置。

创建窗口后,不能更改 transparent 属性。透明度影响窗口的视觉外观和鼠标行为。在 Windows 和 Mac OS X 中,当像素的 Alpha 值低于特定的阈值(大约在 .06 和 .01 之间变化,具体取决于操作系统)时,窗口将无法捕获鼠标事件。在 Linux 中,窗口将捕获完全透明区域上方的鼠标事件,从而阻止用户访问桌面上的其他窗口和项目。

注意:并不总是支持窗口透明度。如果用户的操作系统配置不提供透明度,则创建窗口时将不含透明度。原本要透明的区域将混合为黑色。请使用 NativeWindow.supportsTransparency 属性确定是否支持窗口透明度。



实现
    public function get transparent():Boolean

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

type

属性 
type:String  [只读]

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

报告用于创建此窗口的窗口 type 设置。

NativeWindow.type 返回的值将是在 NativeWindowType 类中定义的常量之一。

创建窗口后,不能更改 type 设置。



实现
    public function get type():String

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

visible

属性 
visible:Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

指定此窗口是否可见。

不可见窗口不显示在桌面上,但所有窗口属性和方法都是有效的。

在默认情况下,visible 设置为 false。要显示窗口,请将 visible 设置为 true 或调用 NativeWindow.activate()

如果此窗口有所有者,该所有者窗口的可见状态确定是否显示此窗口。如果不显示所有者窗口,则不显示任何拥有的窗口,即使其 visible 属性为 true

注意:在 Mac OS X 中,对一个最小化的窗口设置 visible=false 不会从停靠处删除该窗口图标。如果用户随后单击该停靠图标,该窗口将返回可见状态并显示在桌面上。



实现
    public function get visible():Boolean
    public function set visible(value:Boolean):void

引发
SecurityError — 在没有足够权限的情况下尝试设置为 false 时。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素


示例  ( 如何使用本示例 )
下列示例演示如何访问窗口的 visible 属性:
windowObj.visible = true;
使用对窗口舞台上的显示对象的引用:
displayObj.stage.nativeWindow.visible = true;
从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.visible = true;
    

width

属性 
width:Number

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的宽度(以像素为单位)。

为本机窗口报告的尺寸包括显示的任何系统窗口镶边。可以从 Stage.stageWidth 属性获取窗口内部可用的显示区域宽度。

更改窗口的 width 属性等效于通过 bounds 属性更改宽度。

如果指定宽度小于允许的最小值或大于允许的最大值,则会将窗口宽度设置为最接近的合法大小。决定宽度的最小值和最大值的因素包括以下这些:

  • NativeWindow 对象的 minSize.y 属性和 maxSize.y 属性
  • 操作系统的最小限值和最大限值,即 NativeWindow.systemMinSize.yNativeWindow.systemMaxSize.y 的值。
  • 在 Adobe AIR 中,窗口宽度的最大值是 4095 像素(在 AIR 1.5 及早期版本中是 2880 像素)。

在 Linux 上,设置 width 属性是一种异步操作。

要检测宽度更改是否完成,请侦听 resize 事件,所有平台上都会调度该事件。

当窗口的宽度更改时,像素值将舍入为最近的整数。



实现
    public function get width():Number
    public function set width(value:Number):void

引发
ArgumentError — 如果设置的值为 null 或无效。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

x

属性 
x:Number

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的左上角相对于操作系统桌面原点的水平轴坐标。

在安装了多个显示器的系统中,x 可能为负。如果保存该值可能是为了将窗口重新定位在上次的位置,则应始终验证在还原位置时是否将窗口放置到可用的位置。更改屏幕分辨率或显示器布置可能会导致窗口被置于屏幕以外。使用 Screen 类可获取有关桌面几何形状的信息。

更改窗口的 x 属性等效于通过 bounds 属性更改位置。

在 Linux 上,设置 x 属性是一种异步操作。

要检测位置更改是否完成,请侦听 move 事件,所有平台上都会调度该事件。

当窗口的 x 坐标更改时,像素值将舍入为最近的整数。



实现
    public function get x():Number
    public function set x(value:Number):void

引发
ArgumentError — 如果设置的值为 null 或无效。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

    

y

属性 
y:Number

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

此窗口的左上角相对于操作系统桌面左上角的垂直轴坐标。

在安装了多个显示器的系统中,y 可能为负。如果保存该值可能是为了将窗口重新定位在上次的位置,则应始终验证在还原位置时是否将窗口放置到可用的位置。更改屏幕分辨率或显示器布置可能会导致窗口被置于屏幕以外。使用 Screen 类可获取有关桌面几何形状的信息。

更改窗口的 y 属性等效于通过 bounds 属性更改位置。

在 Linux 上,设置 y 属性是一种异步操作。

要检测位置更改是否完成,请侦听 move 事件,所有平台上都会调度该事件。

当窗口的 y 坐标更改时,像素值将舍入为最近的整数。



实现
    public function get y():Number
    public function set y(value:Number):void

引发
ArgumentError — 如果设置的值为 null 或无效。
 
IllegalOperationError — 如果在关闭此窗口后访问该属性。

相关 API 元素

构造函数详细信息
    

NativeWindow

()构造函数
public function NativeWindow(initOptions:NativeWindowInitOptions)

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

创建新的 NativeWindow 实例和相应的操作系统窗口。

创建窗口后,不能更改 initOptions 参数中定义的设置。无效的 initOptions 设置将导致引发非法操作错误。在当前系统中有效但不可用的设置不会引发异常。如果需要,可以使用静态 NativeWindow 成员(比如 systemMaxSize)来检测特定于当前操作系统的窗口功能。

默认窗口大小由操作系统决定,并且窗口是在不可见状态下创建。要防止将窗口更改为可见,请不要将窗口的 visible 属性更改为 true 或者在窗口更改完成前调用 activate()

参数
initOptions:NativeWindowInitOptions — 一个包含此窗口初始化属性的对象。

引发
IllegalOperationError — 如果 initOptions 参数无效。

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例将创建并激活一个新的 NativeWindow 实例:
import flash.display.NativeWindowInitOptions;
import flash.display.NativeWindowSystemChrome;
import flash.display.NativeWindowType;
import flash.display.NativeWindow;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.geom.Rectangle;

var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;
windowOptions.type = NativeWindowType.NORMAL;

var newWindow:NativeWindow = new NativeWindow(windowOptions);
newWindow.stage.scaleMode = StageScaleMode.NO_SCALE;
newWindow.stage.align = StageAlign.TOP_LEFT;
newWindow.bounds = new Rectangle(100, 100, 800, 800);

newWindow.activate();
方法详细信息

    activate

()方法
public function activate():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

激活此窗口。

激活一个窗口将会:

  • 使该窗口可见
  • 将该窗口置于前面
  • 为该窗口提供键盘和鼠标焦点

在 Linux 上,activate() 是一种异步操作。

在所有平台上,NativeWindow 对象都会调度 activate 事件。

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例演示如何激活窗口。

使用对窗口舞台上的显示对象的引用:

displayObject.stage.nativeWindow.activate();

使用对 NativeWindow 类的实例的引用:
windowObj.activate();

从窗口中呈现的 HTML 页中的 JavaScript(此处的 window 是全局 JavaScript window 对象):
window.nativeWindow.activate();

    close

()方法 
public function close():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

关闭此窗口。

关闭操作一旦完成即调度 close 事件。将不调度 closing 事件。如果应该允许取消关闭操作,请调度一个 closing 事件并检查在调用 close() 方法之前是否有任何注册的侦听器取消了默认行为。

关闭一个窗口时,它所拥有的任何窗口也将被关闭。拥有的窗口不调度 closing 事件。

如果未在其他位置引用当前处于此窗口中的显示对象实例,则会将这些实例作为垃圾回收,除非它们位于由 AIR 创建的初始应用程序窗口中。要允许将初始窗口中的显示对象作为垃圾进行回收,请将它们从窗口舞台上删除。

关闭后的 NativeWindow 对象仍然是有效的引用,但访问大多数属性和方法都将引发非法操作错误。

关闭的窗口无法重新打开。如果窗口已经关闭,则不执行任何动作,也不调度任何事件。

注意:要在不关闭窗口的情况下隐藏一个窗口,请将该窗口的 visible 属性设置为 false

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例演示如何关闭窗口:

通过引用 NativeWindow 实例 (windowObj):

windowObj.close();


使用对窗口舞台上的显示对象的引用:
displayObj.stage.nativeWindow.close();

从 HTMLLoader 对象(或 HTML 根窗口)中运行的 JavaScript 例程:
window.close(); //overriddable in HTMLHost

或:
window.nativeWindow.close(); //not overriddable

下面的示例演示如何允许取消关闭操作(其中 windowObj 是要关闭的 NativeWindow 实例):
public function closeCommand():Boolean{
    var closeEvent:Event = new Event(Event.CLOSING,true,true);
    windowObj.dispatchEvent(closeEvent);
    if(!closeEvent.isDefaultPrevented()){
        windowObj.close();
        return true;
    } else {
      return false;
    }
}

下面的示例演示如何从 HTMLLoader 对象(或 HTML 根窗口)中运行的 JavaScript 例程关闭窗口,同时允许取消该操作:
<script src="AIRAliases.js" type="text/javascript"></script>
<script type="text/javascript">
    var dirtyData = false;
    function closeWindow(){
            var closingEvent = new air.Event(air.Event.CLOSING,true,true);
            window.nativeWindow.dispatchEvent(closingEvent);
               if(!closingEvent.isDefaultPrevented()){
                   window.nativeWindow.close();
                //or use: window.close(); 
               return true;
           } else {
               return false;
        }
    }
        
    function onClosing(event){
        if(dirtyData){
            event.preventDefault();
            //Save data...
        }
    }    

    window.nativeWindow.addEventListener(air.Event.CLOSING,onClosing);        
</script>

    globalToScreen

()方法 
public function globalToScreen(globalPoint:Point):Point

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

将像素坐标中相对于窗口舞台原点(就显示列表而言为全局点)转换为虚拟桌面上的点。

虚拟桌面坐标相对于主监视器的左上角。

参数

globalPoint:Point — 要转换为屏幕上的点的舞台上的点。

返回
Point — 指定的相对于桌面的全局点。

相关 API 元素

    listOwnedWindows

()方法 
public function listOwnedWindows():Vector.<NativeWindow>

语言版本: ActionScript 3.0
运行时版本: AIR 2.6

返回此窗口所拥有的 NativeWindow 对象的列表。

您不能通过在返回的矢量中添加或删除对象来更改 NativeWindows 的所有权。创建窗口后,不能更改窗口所有权。

返回
Vector.<NativeWindow> — 包含此实例拥有的零个或更多 NativeWindow 对象的 Vector.<NativeWindow> 对象。

相关 API 元素

    maximize

()方法 
public function maximize():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

使此窗口最大化。

调用 maximize() 将调度 displayStateChange 事件,如果适用,还将调度 moveresize 事件。系统镶边将调度 displayStateChanging 事件,当用户启动最大化命令时可取消该事件,如果需要,您的最大化逻辑必须实现此行为。

maximize() 方法异步执行。要检测状态更改是否完成,请侦听 displayStateChange 事件。如果窗口已经最大化,则不执行任何动作,也不调度任何事件。

操作系统行为注意事项:

  • 在某些操作系统(如 Mac OS X)中,将窗口最大化并不会同时阻止调整大小,调用 maximize() 将缩放窗口以填充屏幕,但并不阻止随后的调整窗口大小。调整经过缩放的窗口的大小也会还原显示状态。
  • 在某些操作系统(如 Mac OS X)中以及在某些 Linux 窗口管理器中,将窗口最大化并不会将窗口扩大至超出 maxSize 属性中指定的宽度和高度。在其他操作系统中,即使屏幕大于 maxSize,也将扩大窗口以填充屏幕。
  • 某些 Linux 窗口管理器不允许将实用程序窗口最大化。


引发
IllegalOperationError — 如果在此窗口关闭后才调用此方法。

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例演示如何允许取消最大化操作:
public function maximizeWindow(nativeWin:NativeWindow):Boolean{
  if(nativeWin.displayState != NativeWindowDisplayState.MAXIMIZED){
    var beforeState:String = nativeWin.displayState;
    var afterState:String = NativeWindowDisplayState.MAXIMIZED;
    var displayStateEvent:NativeWindowDisplayStateEvent = 
        new NativeWindowDisplayStateEvent(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
    nativeWin.dispatchEvent(displayStateEvent);
    if(!displayStateEvent.isDefaultPrevented()){
        nativeWin.maximize();
        return true;
    } else {
      return false;
    }
  }
  return false;
}

下面的示例演示如何允许在窗口(或 HTML 窗口)上的 HTMLLoader 对象中运行的 JavaScript 例程中取消最大化操作:
function maximizeWindow(nativeWin){
    if(nativeWin.displayState != air.NativeWindowDisplayState.MAXIMIZED){
        var beforeState = nativeWin.displayState;
        var afterState = air.NativeWindowDisplayState.MAXIMIZED;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        nativeWin.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            nativeWin.maximize();
            return true;
        } else {
          return false;
        }
     }
     return false;
}

    minimize

()方法 
public function minimize():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

使此窗口最小化。

调用 minimize() 将调度 displayStateChange 事件,如果适用,还将调度 move 和 resize 事件。系统镶边将调度 displayStateChanging 事件,当用户启动最小化命令时可取消该事件,而直接调用 minimize() 不能调度该事件。如果需要,您的最小化逻辑可以实现此行为。

minimize() 方法异步执行。要检测状态更改是否完成,请侦听 displayStateChange 事件,所有平台上都会调度该事件。如果窗口已经最小化,则不执行任何动作,也不调度任何事件。

此窗口拥有的任何窗口在该窗口最小化时隐藏起来。拥有的窗口不调度 displayStateChangingdisplayStateChange 事件。

注意:

  • 在 Windows 中,最小化不可见窗口 (visible == false) 将显示窗口。
  • 某些 Linux 窗口管理器不允许将实用程序窗口最小化。


引发
IllegalOperationError — 如果在此窗口关闭后才调用此方法。

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例演示如何通过调度 displayStateChanging 事件来允许取消对 minimize() 的调用:
public function minimizeWindow(nativeWin:NativeWindow):Boolean{
    if(nativeWin.displayState != NativeWindowDisplayState.MINIMIZED){
        var beforeState:String = nativeWin.displayState;
        var afterState:String = NativeWindowDisplayState.MINIMIZED;
        var displayStateEvent:NativeWindowDisplayStateEvent = 
            new NativeWindowDisplayStateEvent(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        nativeWin.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            nativeWin.minimize();
            return true;
        } else {
          return false;
        }
     }
     return false;
}

下面示例演示如何允许在 HTMLLoader 对象(或 HTML 窗口)中运行的 JavaScript 中取消对 minimize() 的调用:
 
function minimizeWindow(){
    if(window.nativeWindow.displayState != air.NativeWindowDisplayState.MINIMIZED){
        var beforeState = window.nativeWindow.displayState;
        var afterState = air.NativeWindowDisplayState.MINIMIZED;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        window.nativeWindow.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            window.nativeWindow.minimize();
            return true;
        } else {
          return false;
        }
     }
     return false;
}

    notifyUser

()方法 
public function notifyUser(type:String):void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

通过操作系统触发可视提示:发生了需要关注的事件。

NativeWindow.supportsNotificationtrue 时,可视提示将遵循本机系统的操作系统约定。例如在 Windows 中,任务栏图标将闪烁。

type 参数确定提示的强度。用作允许值的常量在 NotificationType 类中定义,这些常量可以是:

  • NotificationType.INFORMATIONAL
  • NotificationType.CRITICAL

为信息性通知提供的提示持续时间很短,而为关键通知提供的提示将持续到用户激活此窗口为止。并非所有 Linux 窗口管理器都支持两种通知级别。对于此类窗口管理器,无论指定哪个选项,notifyUser() 的效果都将相同。

注意:允许在 NativeWindow.supportsNotificationfalse 时调用 notifyUser(),但不执行任何操作。

参数

type:String — 一个表示通知紧急程度的字符串。

    orderInBackOf

()方法 
public function orderInBackOf(window:NativeWindow):Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

将此窗口放在紧靠指定窗口后面。

不要激活此窗口或应用程序或获取其焦点。最小化或隐藏的 (visiblefalse) 窗口无法重新排序。

拥有的窗口从不会移动到所有者的后面。如果此窗口有所有者,则该所有者及其所拥有的其他窗口也会排在目标后面。如果目标窗口有所有者,则此窗口排在目标的所有者的后面。

某些 Linux 窗口管理器不允许将实用程序窗口排在常规窗口之后。

参数

window:NativeWindow — 一个应用程序窗口。

返回
Boolean — 如果此窗口成功地放到了后面,则为 true;如果此窗口不可见或最小化,则为 false

示例  ( 如何使用本示例 )

下面的示例显示如何通过引用 NativeWindow 实例将一个窗口移动到紧靠另一个窗口下面:
windowBehind.orderInBackOf(windowFront);

使用对窗口舞台上的显示对象的引用:
displayObjBehind.stage.nativeWindow.orderInBackOf(displayObjectFront.stage.nativeWindow);


从使用对两个 JavaScript 窗口对象的引用的 HTMLLoader 对象(或 HTML 根窗口)中运行的 JavaScript 例程中:
jsWindowObjBehind.nativeWindow.orderInBackOf(jsWindowObjFront.nativeWindow);

    orderInFrontOf

()方法 
public function orderInFrontOf(window:NativeWindow):Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

将此窗口放在紧靠指定窗口前面。

不要激活此窗口或应用程序或获取其焦点。最小化或隐藏的 (visiblefalse) 窗口无法重新排序。

窗口从不会移到属于它的窗口的前面。如果此窗口有所有者,则该所有者及其所拥有的其他窗口也会排在目标前面。如果目标窗口有所有者,则此窗口也会排在与目标拥有同一所有者的任何其他窗口的前面。

某些 Linux 窗口管理器不允许将常规窗口排在实用程序窗口之前。

参数

window:NativeWindow — 一个应用程序窗口。

返回
Boolean — 如果此窗口成功地放到了前面,则为 true;如果此窗口不可见或最小化,则为 false

示例  ( 如何使用本示例 )

下面的示例显示如何通过引用 NativeWindow 实例将一个窗口移动到紧靠另一个窗口上面:
windowFront.orderInFrontOf(windowBehind);

使用对窗口舞台上的显示对象的引用:
displayObjFront.stage.nativeWindow.orderInFrontOf(displayObjectBehind.stage.nativeWindow);


从使用对两个 JavaScript 窗口对象的引用的 HTMLLoader 对象(或 HTML 根窗口)中运行的 JavaScript 例程中:
jsWindowObjFront.nativeWindow.orderInFrontOf(jsWindowObjBehind.nativeWindow);

    orderToBack

()方法 
public function orderToBack():Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

将此窗口放在任何其他可见窗口后面。

不要激活此窗口或应用程序或获取其焦点。最小化或隐藏的 (visiblefalse) 窗口无法重新排序。

如果 alwaysInFronttrue,则调用此方法不会将此窗口置于任何 alwaysInFront 设置为 false 的窗口的后面。

拥有的窗口从不会移动到所有者的后面。如果此窗口有所有者,则该所有者及其所拥有的其他窗口也会排在窗口显示列表的底部。此窗口将移到同一窗口拥有的任何其他窗口的后面。如果此窗口拥有其他窗口,则那些窗口也移到后面,保持当前它们相互之间的顺序。

某些 Linux 窗口管理器不允许将实用程序窗口排在常规窗口之后。

返回
Boolean — 如果此窗口成功地放到了后面,则为 true;如果此窗口不可见或最小化,则为 false

示例  ( 如何使用本示例 )

下面的示例显示如何将某个窗口放在应用程序中所有其他窗口(使用同样的 alwaysInFront 设置)的后面:
windowObj.orderToBack();


使用对窗口舞台上的显示对象的引用:
displayObj.stage.nativeWindow.orderToBack();

从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.orderToBack();

    orderToFront

()方法 
public function orderToFront():Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

将此窗口放在任何其他可见窗口前面。

不要激活此窗口或应用程序或获取其焦点。最小化或隐藏的 (visiblefalse) 窗口无法重新排序。

如果 alwaysInFrontfalse,则调用此方法不会将此窗口置于任何已将 alwaysInFront 设置为 true 的窗口的前面。

窗口从不会移到属于它的窗口的前面。如果此窗口拥有其他窗口,则那些窗口也移到前面,保持当前它们相互之间的顺序。如果此窗口有所有者,则该所有者及其所拥有的其他窗口也会排在窗口显示列表的前面。此窗口移到具有同一所有者的其他窗口的前面。

某些 Linux 窗口管理器不允许将常规窗口排在实用程序窗口之前。

返回
Boolean — 如果此窗口成功地放到了前面,则为 true;如果此窗口不可见或最小化,则为 false

示例  ( 如何使用本示例 )

下面的示例显示如何将某个窗口放在应用程序中所有其他窗口(使用同样的 alwaysInFront 设置)的前面:
windowObj.orderToFront();


使用对窗口舞台上的显示对象的引用:
displayObj.stage.nativeWindow.orderToFront();

从窗口(或 HTML 根窗口)的 HTMLLoader 对象中运行的 JavaScript 例程:
window.nativeWindow.orderToFront();

    restore

()方法 
public function restore():void

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

从最小化或最大化状态还原此窗口。

调用 restore() 将调度 displayStateChange 事件,如果适用,还将调度 moveresize 事件。系统镶边将调度 displayStateChanging 事件,当用户启动还原命令时可取消该事件,如果需要,您的还原逻辑必须实现此行为。

如果窗口已经处于 NativeWindowDisplayState.NORMAL 状态,则不执行任何动作,也不调度任何事件。

要检测状态更改是否完成,请侦听 displayStateChange 事件,所有平台上都会调度该事件。


引发
IllegalOperationError — 如果在已关闭此窗口后调用此方法。

相关 API 元素


示例  ( 如何使用本示例 )

下面的示例演示如何允许取消还原操作:
public function restoreWindow(nativeWin:NativeWindow):Boolean{
    if(nativeWin.displayState != NativeWindowDisplayState.NORMAL){
        var beforeState:String = nativeWin.displayState;
        var afterState:String = NativeWindowDisplayState.NORMAL;
        var displayStateChangingEvent:NativeWindowDisplayStateEvent = 
            new NativeWindowDisplayStateEvent(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        nativeWin.dispatchEvent(displayStateChangingEvent);
        if(!displayStateChangingEvent.isDefaultPrevented()){
            nativeWin.restore();
            return true;
        } else {
          return false;
        }
     }
     return false;
}

下面的示例演示如何允许在窗口(或 HTML 窗口)上的 HTMLLoader 对象中运行的 JavaScript 例程中取消还原操作:
function restoreWindow(nativeWin){
    if(window.nativeWindow.displayState != air.NativeWindowDisplayState.NORMAL){
        var beforeState = window.nativeWindow.displayState;
        var afterState = air.NativeWindowDisplayState.NORMAL;
        var displayStateEvent = 
            new air.NativeWindowDisplayStateEvent(air.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING,
                                              true,true,beforeState,afterState);
        window.nativeWindow.dispatchEvent(displayStateEvent);
        if(!displayStateEvent.isDefaultPrevented()){
            window.nativeWindow.restore();
            return true;
        } else {
          return false;
        }
     }
     return false;
}

    startMove

()方法 
public function startMove():Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

启动此窗口的系统控制移动。

在从 mouseDown 事件调用时,此方法开始一个由鼠标驱动的移动序列,该序列将持续到发生 mouseUp 事件为止。

在从其他代码调用时,此方法开始一个由键盘或鼠标驱动的移动序列,该序列与操作系统的默认序列一致。

在移动序列执行期间,随着窗口原点的移动,将调度一系列事件。对于每次增量移动,首先调度一个 moving 事件,然后,如果未取消该 moving 事件,则将更新窗口位置并调度一个 move 事件。如果取消了 moving 事件,则移动序列将立即终止。

返回
Boolean — 如果成功启动了移动,则为 true;如果最大化了窗口,则为 false

引发
IllegalOperationError — 如果在已关闭此窗口后调用此方法。

示例  ( 如何使用本示例 )

下面的示例演示如何为响应 mouseDown 事件来移动窗口:
var initOpts:NativeWindowInitOptions = new NativeWindowInitOptions();
var win:NativeWindow = new NativeWindow(initOpts);
win.activate();
win.stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

function mouseDownHandler(event:MouseEvent):void
{
    win.startMove();
}

    startResize

()方法 
public function startResize(edgeOrCorner:String = "BR"):Boolean

语言版本: ActionScript 3.0
运行时版本: AIR 1.0

启动此窗口的系统控制调整大小操作。

在从 mouseDown 事件处理函数调用时,此方法开始一个由鼠标驱动的调整大小序列,该序列将持续到发生 mouseUp 事件为止。

在从其他代码调用时,此方法开始一个由键盘或鼠标驱动的调整大小序列,该序列与操作系统的默认序列一致。

在调整大小序列执行期间,随着窗口尺寸的更改,将调度一系列事件。对于每次增量更改,首先调度一个 resizing 事件,然后,如果未取消该 resizing 事件,则将更新窗口尺寸并调度一个 resize 事件。如果取消了 resizing 事件,则该序列将立即终止。

参数

edgeOrCorner:String (default = "BR") — NativeWindowResize 类中的一个常量,用于指定要调整此窗口的哪个边或角的大小。以下是有效值:

垂直对齐方式水平对齐方式
NativeWindowResize.TOP顶对齐居中对齐
NativeWindowResize.BOTTOM底对齐居中对齐
NativeWindowResize.LEFT居中对齐左对齐
NativeWindowResize.RIGHT居中对齐右对齐
NativeWindowResize.TOP_LEFT顶对齐左对齐
NativeWindowResize.TOP_RIGHT顶对齐右对齐
NativeWindowResize.BOTTOM_LEFT底对齐左对齐
NativeWindowResize.BOTTOM_RIGHT底对齐右对齐
NativeWindowResize.NONE----

返回
Boolean — 如果成功启动了调整大小,则为 true;如果最大化了窗口,则为 false

引发
IllegalOperationError — 如果在已关闭此窗口后调用此方法。

相关 API 元素


示例  ( 如何使用本示例 )

下面示例演示如何为响应 mouseDown 事件来调整窗口大小:
stage.addEventListener(MouseEvent.MOUSE_DOWN, onResizeCommand);

function onResizeCommand(event:MouseEvent):void
{
    var win:NativeWindow = event.target.nativeWindow;
    var resizeFrom:String = "";
    if (event.stageY < win.height * .33)
    {
        resizeFrom = NativeWindowResize.TOP;
    }
    else if (event.stageY > win.height * .66)
    {
        resizeFrom = NativeWindowResize.BOTTOM;
    }
    if (event.stageX < win.width * .33)
    {
        resizeFrom += NativeWindowResize.LEFT;
    }
    else if (event.stageX > win.width * .66)
    {
        resizeFrom += NativeWindowResize.RIGHT;
    }
    win.startResize(resizeFrom);    
}
事件详细信息
    

activate

事件
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.ACTIVATE

运行时版本: AIR 1.0

在激活窗口后由此 NativeWindow 对象调度。

ACTIVATE 常量定义 activate 事件对象的 type 属性的值。

注意:此事件既不具有“捕获阶段”也不具有“冒泡阶段”,这意味着必须直接将事件侦听器添加到任何潜在的目标,而无论目标是否位于显示列表中。

AIR for TV 设备从不自动调度此事件。 但是您可以手动调度。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target具有为 activate 事件注册的侦听器的任何 DisplayObject 实例。
    

close

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.CLOSE

运行时版本: AIR 1.0

在关闭窗口后由此 NativeWindow 对象调度。

Event.CLOSE 常量定义 close 事件对象的 type 属性的值。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target已关闭其连接的对象。
    

closing

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.CLOSING

运行时版本: AIR 1.0

在关闭窗口的前一刻由此 NativeWindow 对象调度。可以取消此事件以避免关闭窗口。

Event.CLOSING 常量定义 closing 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubblesfalse
cancelabletrue;取消此事件对象将停止关闭操作。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target要关闭其连接的对象。
    

deactivate

事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.DEACTIVATE

运行时版本: AIR 1.0

在取消激活窗口后由此 NativeWindow 对象调度。

Event.DEACTIVATE 常量定义 deactivate 事件对象的 type 属性值。

注意:此事件既不具有“捕获阶段”也不具有“冒泡阶段”,这意味着必须直接将事件侦听器添加到任何潜在的目标,而无论目标是否位于显示列表中。

AIR for TV 设备从不自动调度此事件。 但是您可以手动调度。

此事件具有以下属性:

属性
bubblesfalse
cancelablefalse;没有要取消的默认行为。
currentTarget当前正在使用某个事件侦听器处理 Event 对象的对象。
target具有为 deactivate 事件注册的侦听器的任何 DisplayObject 实例。
    

displayStateChange

事件  
事件对象类型: flash.events.NativeWindowDisplayStateEvent
属性 NativeWindowDisplayStateEvent.type = flash.events.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGE

运行时版本: AIR 1.0

在窗口的 displayState 属性更改后由此 NativeWindow 对象调度。

不要调整窗口大小或更改其在 displayStateChange 事件处理程序中的显示状态。

定义 displayStateChange 事件对象的 type 属性的值。

此事件具有以下属性:

属性
afterDisplayState窗口的旧显示状态。
beforeDisplayState窗口的新显示状态。
target刚刚更改状态的 NativeWindow 实例。
bubbles否。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
cancelablefalse;没有要取消的默认行为。
    

displayStateChanging

事件  
事件对象类型: flash.events.NativeWindowDisplayStateEvent
属性 NativeWindowDisplayStateEvent.type = flash.events.NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING

运行时版本: AIR 1.0

在窗口更改其显示状态的前一刻由此 NativeWindow 对象调度。可以取消此事件以避免更改。

定义 displayStateChanging 事件对象的 type 属性的值。

此事件具有以下属性:

属性
afterDisplayState未处理的更改之前的窗口显示状态。
beforeDisplayState未处理的更改之后的窗口显示状态。
target刚刚更改状态的 NativeWindow 实例。
bubbles否。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
cancelabletrue;取消该事件会阻止更改。

示例  ( 如何使用本示例 )

下面的示例演示如何取消 displayStateChanging 事件。
function displayStateChanging_handler(displayStateEvent:NativeWindowDisplayStateEvent):void
{
  //shouldStopStateChange is an application-defined Boolean indicating 
  //that display state changes should be canceled
  if (displayStateEvent.type == NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING 
                                  &&    shouldStopStateChange)
  {
    displayStateEvent.preventDefault();
  }
}
    

move

事件  
事件对象类型: flash.events.NativeWindowBoundsEvent
属性 NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.MOVE

运行时版本: AIR 1.0

在桌面上移动窗口后由此 NativeWindow 对象调度。

每当窗口原点(xy 属性)更改时调度 move 事件,窗口原点的更改可能是系统控制的窗口移动操作的结果:最小化、最大化或还原窗口、或通过设置 xybounds 属性更改窗口位置。

注意:在 NativeWindow 对象的 movingmove 事件的处理函数中,避免可能会同时打开操作系统对话框的动作。例如,如果两个处理函数都引发错误,则可能发生这种情况。如果真的发生这种情况,则打开的第二个对话框将不会注册鼠标单击,必须使用键盘才能取消。

定义 move 事件对象的 type 属性值。

此事件具有以下属性:

属性
afterBounds窗口的新范围。
beforeBounds窗口的旧范围。
target刚刚更改状态的 NativeWindow 对象。
bubbles否。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
cancelablefalse;没有要取消的默认行为。
    

moving

事件  
事件对象类型: flash.events.NativeWindowBoundsEvent
属性 NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.MOVING

运行时版本: AIR 1.0

在桌面上移动窗口的前一刻由此 NativeWindow 对象调度。可以取消此事件以避免或修改移动。

注意:在 NativeWindow 对象的 movingmove 事件的处理函数中,避免可能会同时打开操作系统对话框的动作。例如,如果两个处理函数都引发错误,则可能发生这种情况。如果真的发生这种情况,则打开的第二个对话框将不会注册鼠标单击,必须使用键盘才能取消。

定义 moving 事件对象的 type 属性值。

此事件具有以下属性:

属性
afterBounds未处理的更改之后的窗口范围。
beforeBounds未处理的更改之前的窗口范围。
bubbles否。
cancelabletrue;取消该事件会阻止窗口移动。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
target刚刚更改状态的 NativeWindow 对象。

注意:在 Linux 上,此事件不支持 preventDefault() 方法。

    

resize

事件  
事件对象类型: flash.events.NativeWindowBoundsEvent
属性 NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.RESIZE

运行时版本: AIR 1.0

在调整窗口大小后由此 NativeWindow 对象调度。每当窗口大小(widthheight 属性)更改时调度 resize 事件,窗口大小的更改可能是系统控制的窗口大小调整操作的结果:最小化、最大化或还原窗口、或通过设置 widthheightbounds 属性更改窗口大小。NativeWindow 的 resize 事件是在系统控制的调整大小循环中调度的。相反,Stage 对象的 resize 事件是在舞台准备好绘图时调度的。

定义 resize 事件对象的 type 属性值。

此事件具有以下属性:

属性
afterBounds窗口的新范围。
beforeBounds窗口的旧范围。
target刚刚更改状态的 NativeWindow 对象。
bubbles否。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
cancelablefalse;没有要取消的默认行为。

相关 API 元素

    

resizing

事件  
事件对象类型: flash.events.NativeWindowBoundsEvent
属性 NativeWindowBoundsEvent.type = flash.events.NativeWindowBoundsEvent.RESIZING

运行时版本: AIR 1.0

在桌面上调整窗口大小的前一刻由此 NativeWindow 对象调度。可以取消此事件以避免或修改调整大小。

定义 resizing 事件对象的 type 属性值。

此事件具有以下属性:

属性
afterBounds未处理的更改之后的窗口范围。
beforeBounds未处理的更改之前的窗口范围。
target刚刚更改状态的 NativeWindow 对象。
bubbles否。
currentTarget表示当前正在使用事件侦听器处理该 Event 对象的对象。
cancelabletrue;取消该事件会阻止窗口移动。

注意:在 Linux 上,此事件不支持 preventDefault() 方法。


示例  ( 如何使用本示例 )

下面的示例演示如何取消 resizing 事件。
function boundsChanging_handler(boundsEvent:NativeWindowBoundsEvent):void
{
  //shouldStopResize is an application-defined Boolean indicating 
  //that resize operations should be canceled
  if (boundsEvent.type == NativeWindowBoundsEvent.RESIZING && shouldStopResize)
  {
    boundsEvent.preventDefault();
  }
}




[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。