適用於 Adobe® Flash® Platform 的 ActionScript® 3.0 參考
首頁  |  隱藏套件和類別清單 |  套件  |  類別  |  新增內容  |  索引  |  附錄  |  為什麼顯示英文?
篩選: AIR 30.0 和更早版本, Flash Player 30.0 和更早版本, Flash Lite 4
Flex 4.6 和更早版本, Flash Pro CS6 和更早版本
隱藏篩選
flash.desktop 

NativeProcess  - 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 標籤
移動 XML 元素
Timed Text 標籤
不建議元素清單
AccessibilityImplementation 常數
如何使用 ActionScript 範例
法律聲明
套件flash.desktop
類別public class NativeProcess
繼承NativeProcess Inheritance EventDispatcher Inheritance Object

語言版本: ActionScript 3.0
執行階段版本: AIR 2

NativeProcess 類別提供命令列整合以及一般啟動功能。NativeProcess 類別可以讓 AIR 應用程式在主機作業系統上執行原生處理程序。AIR 應用程式可以監督處理程序的標準輸入 (stdin) 以及標準輸出 (stdout) 串流,以及處理程序的標準錯誤 (stderr) 串流。

只有使用原生安裝程式 (延伸的桌面描述檔應用程式) 的 AIR 應用程式,才可以使用 NativeProcess 類別以及它的功能。除錯時,您可以將 -profile extendedDesktop 引數傳送至 ADL,來啟用 NativeProcess 功能。在執行階段中,您可以檢查 NativeProcess.isSupported 屬性,判斷是否支援原生處理程序通訊。

AIR 描述檔支援:使用原生安裝程式部署至桌上型電腦作業系統的應用程式支援此項功能。行動裝置或 AIR for TV 裝置不支援此項功能。您可以使用 NativeProcess.isSupported 屬性測試執行階段的支援狀況。如需有關跨多個描述檔之 API 支援的詳細資訊,請參閱 AIR 描述檔支援

使用原生安裝程式 (延伸的桌面描述檔應用程式) 安裝的 AIR 應用程式也可以使用 File.openWithDefaultApplication 來開啟應用程式。不過,NativeProcess 類別提供直接存取標準輸入、標準輸出以及標準錯誤的管道。

注意:使用 extendedTV 描述檔的 AIR for TV 應用程式,可以使用原生擴充功能執行原生處理程序。同樣地,行動裝置也可以使用原生擴充功能。

檢視範例

更多範例

相關 API 元素



公用屬性
 屬性定義自
 Inheritedconstructor : Object
類別物件的參照或是特定物件實體的建構函數。
Object
      isSupported : Boolean
[靜態] [唯讀] 指出目前的描述檔是否支援執行中的原生處理程序。
NativeProcess
      running : Boolean
[唯讀] 指出這個原生處理程序目前是否執行中。
NativeProcess
      standardError : IDataInput
[唯讀] 可以從這個原生處理程序存取標準錯誤輸出。
NativeProcess
      standardInput : IDataOutput
[唯讀] 可以從這個原生處理程序存取標準輸入。
NativeProcess
      standardOutput : IDataInput
[唯讀] 可以從這個原生處理程序存取標準輸出管道。
NativeProcess
公用方法
 方法定義自
  
    NativeProcess()
建構未初始化的 NativeProcess 物件。
NativeProcess
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
會在 EventDispatcher 物件註冊事件偵聽程式,以便讓偵聽程式收到事件的通知。
EventDispatcher
  
    closeInput():void
關閉此處理程序中的輸入串流。
NativeProcess
 Inherited
會將事件傳送到事件流程。
EventDispatcher
  
    exit(force:Boolean = false):void
嘗試結束原生處理程序。
NativeProcess
 Inherited
會檢查 EventDispatcher 物件是否有對特定的事件類型註冊偵聽程式。
EventDispatcher
 Inherited
指出物件是否有已定義的指定屬性。
Object
 Inherited
指出 Object 類別的實體是否位於指定為參數的物件原型鏈中。
Object
 Inherited
指出指定的屬性是否存在,以及是否可列舉。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
會從 EventDispatcher 物件移除偵聽程式。
EventDispatcher
 Inherited
為迴圈作業設定動態屬性的可用性。
Object
  
開始由特定啟動資訊所指定的原生處理程序。
NativeProcess
 Inherited
傳回代表此物件的字串,根據地區特定慣例進行格式化。
Object
 Inherited
會傳回指定之物件的字串形式。
Object
 Inherited
會傳回指定之物件的基本值。
Object
 Inherited
檢查此 EventDispatcher 物件是否已註冊事件偵聽程式,或者此物件的任何祖系已為特定事件類型註冊事件偵聽程式。
EventDispatcher
事件
 事件 摘要 定義自
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式取得作業系統焦點並成為作用中時傳送。EventDispatcher
 Inherited[廣播事件] 當 Flash Player 或 AIR 應用程式失去作業系統焦點並成為非作用中時傳送。EventDispatcher
  
    exit
發出訊號,說明原生處理程序已經結束。NativeProcess
  發出訊號,說明 NativeProcess 已經關閉它的錯誤串流。NativeProcess
  發出訊號,說明原生處理程序在標準錯誤 (stderror) 串流上有可以讀取的資料。NativeProcess
  發出訊號,說明讀取標準錯誤 (stderror) 串流已經失敗。NativeProcess
  發出訊號,說明 NativeProcess 物件已經呼叫 closeInput 方法,關閉它的輸入串流。NativeProcess
  發出訊號,說明寫入標準輸入 (stdin) 串流已經失敗。NativeProcess
  發出訊號,說明 NativeProcess 已經將資料寫入子處理程序的輸入串流。NativeProcess
  發出訊號,說明 NativeProcess 已經關閉它的輸出串流。NativeProcess
  發出訊號,說明原生處理程序在輸出串流上有可以讀取的資料。NativeProcess
  發出訊號,說明讀取 stdout 串流已經失敗。NativeProcess
屬性詳細資訊
    

isSupported

屬性
isSupported:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 2

指出目前的描述檔是否支援執行中的原生處理程序。只有在 extendedDesktop 描述檔中執行時,此屬性才會傳回 true。此外,對於安裝為 AIR 檔案的應用程式,NativeProcess.isSupported 永遠為 false。您必須用 ADT -target native 旗標來包裝 AIR 應用程式,以便使用 NativeProcess 類別。



實作
    public static function get isSupported():Boolean
    

running

屬性 
running:Boolean  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 2

指出這個原生處理程序目前是否執行中。若您呼叫 start() 方法,而且 NativeProcess 物件尚未傳送 exit 事件,此處理程序就是在執行中。NativeProcess 實體是對應至相關作業系統的單一處理程序。只要相關作業系統處理程序仍在執行中 (從原生處理程序啟動,一直到處理程序將結束代碼傳回給作業系統為止),此屬性會一直是 true



實作
    public function get running():Boolean
    

standardError

屬性 
standardError:IDataInput  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 2

可以從這個原生處理程序存取標準錯誤輸出。只要在這個管道有可以使用的資料,NativeProcess 物件會傳送 ProgressEvent 物件。若在沒有資料時,您嘗試從這個串流讀取資料,則 NativeProcess 物件會擲出 EOFError 異常狀況。

類型為 IDataInput,因為是從目前處理程序輸入資料,即使它是子處理程序的輸出串流。



實作
    public function get standardError():IDataInput

擲回值
EOFError — 若資料不存在而且嘗試進行讀取作業。

相關 API 元素

    

standardInput

屬性 
standardInput:IDataOutput  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 2

可以從這個原生處理程序存取標準輸入。使用此管道,將資料傳送至此處理程序。每一次將資料寫入 input 屬性後,會儘快將資料寫入原生處理程序的輸入管道。

類型為 IDataOutput,因為是從目前處理程序輸出資料,即使它是子處理程序的輸入串流。



實作
    public function get standardInput():IDataOutput

擲回值
IllegalOperationError — 當 running 傳回 false,或嘗試將資料寫入關閉的輸入串流時,則寫入這個值。

相關 API 元素

    

standardOutput

屬性 
standardOutput:IDataInput  [唯讀]

語言版本: ActionScript 3.0
執行階段版本: AIR 2

可以從這個原生處理程序存取標準輸出管道。使用這個管道,從原生處理程序的標準輸出讀取資料。當這個管道有可以使用的資料時,NativeProcess 物件會傳送 ProgressEvent 物件。若在沒有資料時,您嘗試從這個串流讀取資料,則 NativeProcess 物件會擲出 EOFError。

類型為 IDataInput,因為是從目前處理程序輸入資料,即使它是子處理程序的輸出串流。



實作
    public function get standardOutput():IDataInput

擲回值
EOFError — 若資料不存在而且嘗試進行讀取作業。

相關 API 元素

建構函式詳細資料
    

NativeProcess

()建構函式
public function NativeProcess()

語言版本: ActionScript 3.0
執行階段版本: AIR 2

建構未初始化的 NativeProcess 物件。呼叫 start() 方法來開始處理程序。

相關 API 元素

方法詳細資訊

    closeInput

()方法
public function closeInput():void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

關閉此處理程序中的輸入串流。某些命令列應用程式會等候輸入串流關閉後才開始某些作業。當串流關閉後,要等到處理程序結束並重新開始後,才可以重新開啟串流。


事件
ioErrorStandardInput:IOErrorEvent — 關閉處理程序的輸入串流時發生問題。
 
standardInputClose:Event — 輸入串流已經關閉。

    exit

()方法 
public function exit(force:Boolean = false):void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

嘗試結束原生處理程序。

參數

force:Boolean (default = false) — 應用程式是否應該在需要時嘗試強制結束原生處理程序。

force 參數設定成 false,此方法會嘗試正常結束原生處理程序。這個方法會「要求」原生處理程序必須結束。原生執行程序可能會略過此要求,因此不保證此方法真的能讓原生處理程序結束。若原生處理程序結束,NativeProcess 物件只會傳送 NativeProcessExitEvent 事件。

force 參數設定成 true,此方法會嘗試強制結束原生處理程序。呼叫此方法並將 force 參數設定成 true,應該是最後的方法了。呼叫此方法並將 force 參數設定成 true 時,可能會對原生處理程序有關的系統資源狀態產生負面影響。例如,開啟的檔案可能會停留在不一致的狀態中。執行階段會儘量努力,試著強制結束原生處理程序。不過,不保證原生處理程序會結束。若原生處理程序結束,NativeProcess 物件只會傳送 NativeProcessExitEvent 事件。

若 NativeProcess 未成功結束,它會傳送 NativeProcessExitEvent 事件。

    start

()方法 
public function start(info:NativeProcessStartupInfo):void

語言版本: ActionScript 3.0
執行階段版本: AIR 2

開始由特定啟動資訊所指定的原生處理程序。處理程序啟動之後,就會開啟所有輸入和輸出串流。此方法會在要求作業系統啟動指定的處理程序之後立即傳回。若處理程序目前執行中,則 NativeProcess 物件會擲出 IllegalOperationError 異常狀況。若 NativeProcess 物件的 running 屬性傳回 true,則此處理程序正在執行中。若作業系統無法啟動處理程序,就會擲出 Error

NativeProcess 實體是對應至相關作業系統的單一處理程序。若您想在同時執行數個相同的作業系統處理程序,可以為每一個子處理程序建立一個 NativeProcess 個體。

只要 NativeProcess 物件的 running 屬性傳回 false,就可以隨時呼叫此方法。這表示 NativeProcess 物件可以重複使用。換言之,您可以建構一個 NativeProcess 執行處理,呼叫 start() 方法,等候 exit 事件,然後再次呼叫 start() 方法。您可以使用不同的 NativeProcessStartupInfo 物件做為後續呼叫 start() 方法的 info 參數值。

只有使用原生安裝程式的 AIR 應用程式,才可以使用 NativeProcess 類別以及它的功能。除錯時,您可以將 -profile extendedDesktop 引數傳送至 ADL,來啟用 NativeProcess 功能。檢查 NativeProcess.isSupported 屬性,判斷是否支援原生處理程序通訊。

重要安全性注意事項:

原生處理程序 API 可以在使用者的系統上執行任何執行檔。建構以及執行命令時請務必小心。如果要執行之命令的任何部分是從外部來源產生的,請仔細驗證命令是否可以放心執行。否則,您的 AIR 應用程式應該會驗證傳送至運行中執行程序的資料。

不過,驗證輸入實屬不易。若要避免類似的困難,最好是編寫一個擁有特定 API 的原生應用程式 (例如 Windows 上的 EXE)。這些 API 應該只處理 AIR 應用程式特別需要的命令。例如,原生應用程式只會透過標準輸入串流來接受有限的指令集。

Windows 上的 AIR 不允許直接執行 .bat 檔案。命令解譯器應用程式 (cmd.exe) 會執行Windows .bat 檔案。呼叫 .bat 檔案時,當其他應用程式啟動時,這個命令應用程式可以解譯傳送至命令的引數。引數字串中外部字元的惡意插入,會造成 cmd.exe 執行有害或不安全的應用程式。例如,沒有適當的資料驗證,您的 AIR 應用程式會呼叫 myBat.bat myArguments c:/evil.exe。除了執行您的批次檔之外,這個命令應用程式會啟動 evil.exe 應用程式。

如果您使用 .bat 檔案來呼叫 start() 方法,NativeProcess 物件會擲回例外。Error 物件的 message 屬性包含「錯誤 #3219:無法啟動 NativeProcess」字串。

參數

info:NativeProcessStartupInfo — NativeProcessStartupInfo 會定義原生處理程序的啟動方法。


擲回值
IllegalOperationError — 若 NativeProcess 目前執行中。
 
ArgumentError — 若 NativeProcessStartupInfo 的 nativePath 屬性不存在。
 
Error — 若 NativeProcess 未成功啟動。

相關 API 元素

事件詳細資訊
    

exit

事件
事件物件類型: flash.events.NativeProcessExitEvent
屬性 NativeProcessExitEvent.type = flash.events.NativeProcessExitEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明原生處理程序已經結束。exitCode 屬性包含處理程序在結束時傳回至主機作業系統的值。如果 AIR 應用程式是呼叫 NativeProcess 物件的 exit() 方法來終止處理程序,則 exitCode 屬性會設定為 NaN。

    

standardErrorClose

事件  
事件物件類型: flash.events.Event
屬性 Event.type = flash.events.Event

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明 NativeProcess 已經關閉它的錯誤串流。

    

standardErrorData

事件  
事件物件類型: flash.events.ProgressEvent
屬性 ProgressEvent.type = flash.events.ProgressEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明原生處理程序在標準錯誤 (stderror) 串流上有可以讀取的資料。當子處理程序清除它的標準錯誤串流,或者用於在處理程序之間通訊的內部緩衝區已滿時,NativeProcess 物件就會傳送此事件。不要撰寫依賴此內部緩衝區大小的程式碼;它在各種版本和作業系統之間會所有不同。

    

standardErrorIoError

事件  
事件物件類型: flash.events.IOErrorEvent
屬性 IOErrorEvent.type = flash.events.IOErrorEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明讀取標準錯誤 (stderror) 串流已經失敗。當執行階段無法從原生處理程序的標準錯誤管道讀取資料時,NativeProcess 物件可以傳送這個事件。

    

standardInputClose

事件  
事件物件類型: flash.events.Event
屬性 Event.type = flash.events.Event

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明 NativeProcess 物件已經呼叫 closeInput 方法,關閉它的輸入串流。當實際原生處理程序自己關閉輸入串流時,NativeProcess 物件並不會發出此事件。

    

standardInputIoError

事件  
事件物件類型: flash.events.IOErrorEvent
屬性 IOErrorEvent.type = flash.events.IOErrorEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明寫入標準輸入 (stdin) 串流已經失敗。當 closeInput() 方法失敗,或者當執行階段無法將資料寫入原生處理程序的標準輸入管道,NativeProcess 物件就會發出此事件。

    

standardInputProgress

事件  
事件物件類型: flash.events.ProgressEvent
屬性 ProgressEvent.type = flash.events.ProgressEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明 NativeProcess 已經將資料寫入子處理程序的輸入串流。當資料寫入串流後,NativeProcess 物件會送出這個事件。此事件「不會」指出子處理程序是否讀取任何資料。

    

standardOutputClose

事件  
事件物件類型: flash.events.Event
屬性 Event.type = flash.events.Event

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明 NativeProcess 已經關閉它的輸出串流。

    

standardOutputData

事件  
事件物件類型: flash.events.ProgressEvent
屬性 ProgressEvent.type = flash.events.ProgressEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明原生處理程序在輸出串流上有可以讀取的資料。當子處理程序清除它的 stdout 串流,或者用於在處理程序之間通訊的內部緩衝區已滿時,NativeProcess 物件就會傳送此事件。不要撰寫依賴此內部緩衝區大小的程式碼;它在各種版本和作業系統之間會所有不同。

    

standardOutputIoError

事件  
事件物件類型: flash.events.IOErrorEvent
屬性 IOErrorEvent.type = flash.events.IOErrorEvent

語言版本: ActionScript 3.0
執行階段版本: AIR 2

發出訊號,說明讀取 stdout 串流已經失敗。當執行階段無法從原生處理程序的標準輸出管道讀取資料時,NativeProcess 物件可以傳送這個事件。

NativeProcessExample.as

以下範例會檢查機器上是否支援原生處理程序通訊。若的確如此,應用程式會為原生處理程序設定事件偵聽程式,然後在主要應用程式目錄中啟動 test.py 檔案。:
package
{
    import flash.display.Sprite;
    import flash.desktop.NativeProcess;
    import flash.desktop.NativeProcessStartupInfo;
    import flash.events.Event;
    import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import flash.events.NativeProcessExitEvent;
    import flash.filesystem.File;
    
    public class NativeProcessExample extends Sprite
    {
        public var process:NativeProcess;

        public function NativeProcessExample()
        {
            if(NativeProcess.isSupported)
            {
                setupAndLaunch();
            }
            else
            {
                trace("NativeProcess not supported.");
            }
        }
        
        public function setupAndLaunch():void
        {     
            var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
            var file:File = File.applicationDirectory.resolvePath("test.py");
            nativeProcessStartupInfo.executable = file;

            var processArgs:Vector.<String> = new Vector.<String>();
            processArgs[0] = "foo";
            nativeProcessStartupInfo.arguments = processArgs;

            process = new NativeProcess();
            process.start(nativeProcessStartupInfo);
            process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
            process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
            process.addEventListener(NativeProcessExitEvent.EXIT, onExit);
            process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
            process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);
        }

        public function onOutputData(event:ProgressEvent):void
        {
            trace("Got: ", process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable)); 
        }
        
        public function onErrorData(event:ProgressEvent):void
        {
            trace("ERROR -", process.standardError.readUTFBytes(process.standardError.bytesAvailable)); 
        }
        
        public function onExit(event:NativeProcessExitEvent):void
        {
            trace("Process exited with ", event.exitCode);
        }
        
        public function onIOError(event:IOErrorEvent):void
        {
             trace(event.toString());
        }
    }
}
將以下的 Python 指令碼加到應用程式目錄中名稱為 test.py 的檔案 (並確定 Python 已經安裝):
 #!/usr/bin/python
 # ------------------------------------------------------------------------------
 # Sample Python script
 # ------------------------------------------------------------------------------
 
 import sys
 
 for word in sys.argv: #echo the command line arguments
     print word
 
 print "HI FROM PYTHON"
 print "Enter user name" 
 line = sys.stdin.readline()
 
 sys.stdout.write("hello," + line)




[ X ]為什麼顯示英文?
「ActionScript 3.0 參考」的內容是以英文顯示

並非所有「ActionScript 3.0 參考」的內容都翻譯為所有語言。當語言元素未翻譯時,就會以英文顯示。例如,ga.controls.HelpBox 類別並沒有翻譯為任何語言。因此在參考的繁體中文版本中,ga.controls.HelpBox 類別就會以英文顯示。