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

套件 flash.net 

套件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.net 套件包含可用來開啟新瀏覽器視窗、傳送 URL 請求至伺服器以及處理類別別名的套件層級函數。
公用方法
 函數定義自
  
查閱之前已經透過呼叫 registerClassAlias() 方法註冊別名的類別。
flash.net
  
navigateToURL(request:URLRequest, window:String = null):void
會開啟或取代應用程式中的視窗,而該應用程式包含 Flash Player 容器 (通常是指瀏覽器)。
flash.net
  
registerClassAlias(aliasName:String, classObject:Class):void
當物件以 Action Message Format (AMF) 編碼時,會保留該物件的類別 (類型)。
flash.net
  
會將 URL 要求傳送至伺服器,但忽略任何回應。
flash.net
函數詳細資訊

getClassByAlias

()函數
public function getClassByAlias(aliasName:String):Class

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0, Flash Player 9, Flash Lite 4

會查閱之前已經透過呼叫 registerClassAlias() 方法註冊別名的類別。

這個方法不會與 flash.utils.getDefinitionByName() 方法互動。

參數

aliasName:String — 要尋找的別名。

傳回值
Class — 與指定別名相關聯的類別。 如果找不到,就會擲回例外。

擲回值
ReferenceError — 尚未註冊此別名。

相關 API 元素

navigateToURL

()函數 
public function navigateToURL(request:URLRequest, window:String = null):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0, Flash Player 9, Flash Lite 4

開啟或取代應用程式中的視窗,而該應用程式包含 Flash Player 容器 (通常是指瀏覽器)。在 Adobe AIR 中,此函數會在預設的系統網頁瀏覽器中開啟 URL

安全性重要注意事項

開發人員常會將其取自外部來源 (如 FlashVars) 的 URL 值傳遞給 navigateToURL() 函數。攻擊者很可能試圖操控這些外部來源,進而從事跨網站指令碼之類的攻擊。因此,開發人員應先驗證所有的 URL,然後再傳遞這些值給 navigateToURL() 函數。

根據應用程式整體內部使用 URL 的狀況而定,合宜的 URL 資料驗證方式各有不同。最常見的資料驗證技術包括驗證 URL 配置是否得當。例如,若不慎允許 javascript: 這類 URL,可能就會形成跨網站指令碼。驗證 URL 位於您的網域內,可確保 SWF 檔不致公開而遭他人利用重新導向方式進行網路釣魚攻擊。基於強化安全性,您亦可選擇驗證 URL 的路徑,以及驗證 URL 是否遵循 RFC 原則的規範。

例如,下列程式碼示範執行資料驗證的簡易範例,拒絕了任何不是以 http:// 或 https:// 開頭的 URL,並且驗證該 URL 的網域名稱是否為您的網域。此範例未必適用於所有的網路應用程式,您應考慮視需要另對 URL 進行其他檢查。

     // AS3 Regular expression pattern match for URLs that start with http:// and https:// plus your domain name.
     function checkProtocol (flashVarURL:String):Boolean {
        // Get the domain name for the SWF if it is not known at compile time.
        // If the domain is known at compile time, then the following two lines can be replaced with a hard coded string.
        var my_lc:LocalConnection = new LocalConnection();
        var domainName:String = my_lc.domain;
        // Build the RegEx to test the URL.
        // This RegEx assumes that there is at least one "/" after the
        // domain. http://www.mysite.com will not match.
        var pattern:RegExp = new RegExp("^http[s]?\:\\/\\/([^\\/]+)\\/");
        var result:Object = pattern.exec(flashVarURL);
        if (result == null || result[1] != domainName || flashVarURL.length >= 4096) {
          return (false);
        }
        return (true);
     }  
     
      

若為瀏覽器中執行的「本機」內容,則 SWF 檔和包含網頁 (如果有) 必須是位於「本機信任」安全執行程序,才允許呼叫 navigateToURL() 方法透過第一個參數傳遞 URLRequest 物件來指定 "javascript:" 虛擬通訊協定。有些瀏覽器不支援 javascript 通訊協定與 navigateToURL() 方法搭配使用。請考慮改用 ExternalInterface API 的 call() 方法,以便在包含的 HTML 頁面中叫用 JavaScript 方法。

在 Flash Player 以及 Adobe AIR 的非應用程式安全執行程序中,您無法連線到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」

在瀏覽器中執行的 Flash Player 10 和更新版本中,使用這個方法以程式設計的方式開啟彈出式視窗可能不會成功。各種瀏覽器 (和瀏覽器組態設定) 可能隨時封鎖彈出式視窗,所以無法保證彈出式視窗一定會出現。但為了確保最大的成功機會,最好只在為了回應使用者動作 (例如,按下滑鼠或按下按鍵事件的事件處理常式中) 而直接執行的程式碼中使用這個方法來開啟彈出式視窗。

在 Flash Player 10 和更新版本中,如果您使用包含上載 (由 POST 主體中 "content-disposition" 檔頭的 "filename" 參數指示) 的多部分 Content-Type (例如 "multipart/form-data"),POST 作業會受限於上載所套用的安全性規則:

  • 必須執行 POST 作業,以回應使用者啟動的動作 (例如按下滑鼠或按下按鍵)。
  • 如果 POST 作業會跨越網域 (POST 目標與傳送 POST 要求的 SWF 檔不在同一部伺服器上),目標伺服器必須提供允許跨網域存取的 URL 原則。

此外,多部分的 Content-Type 語法必須有效 (符合 RFC2046 標準)。如果語法無效,POST 作業會受限於上載所套用的安全性規則。

在 AIR 中,行動平台上支援 sms: 與 tel: URI 配置。Android 上支援 vipaccess:、connectpro: 及 market: URI 配置。URL 語法會隨著平台慣例而異。例如,在 Android 上,URI 配置必須是小寫。當您使用其中一種配置瀏覽至某個 URL 時,執行階段會在預設應用程式中開啟 URL 以處理配置。因此,瀏覽至 tel:+5555555555 會開啟電話撥號程式,其中已輸入指定的號碼。您必須有個別的應用程式或公用程式 (像是電話撥號程式),才能處理 URL。

下列程式碼會顯示如何在 Android 上叫用 VIP Access 和 Connect Pro 應用程式:

       //Invoke the VIP Access Application.
       navigateToURL(new URLRequest("vipaccess://com.verisign.mvip.main?action=securitycode"));
     
       //Invoke the Connect Pro Application.
       navigateToURL(new URLRequest("connectpro://"));
     
      

參數

request:URLRequest — 指定要瀏覽之 URL 的 URLRequest 物件。

針對 Adobe AIR 中執行的內容,當您使用 navigateToURL() 函數時,執行階段會將使用 POST 方法的 URLRequest (其 method 屬性設為 URLRequestMethod.POST 者) 視同使用 GET 方法的物件。

 
window:String (default = null) — 要在其中顯示 request 參數指定之文件的瀏覽器視窗或 HTML 頁框。 您可以輸入特定視窗的名稱,或使用下列其中一個值:
  • "_self" 會指定目前視窗中的目前頁框。
  • "_blank" 會指定新的視窗。
  • "_parent" 會指定目前頁框的父輩。
  • "_top" 會指定目前視窗中最上層的頁框。

如果您並未指定此參數的值,就會建立新的空白視窗。 在獨立播放程式中,您可以指定新的 ("_blank") 視窗或具名的視窗。 其他值則不適用。

注意:如果於具有檔案系統的本機安全執行程序中執行的 SWF 檔中的程式碼呼叫 navigateToURL() 函數,並為 window 參數指定自訂視窗名稱,就以隨機方式指定視窗名稱。 表單 "_flashXXXXXXXX" 中的名稱,其中每一個 X 分別代表一個隨機十六進位數字。 在相同的工作階段中 (直到您關閉所包含的瀏覽器視窗為止),如果您再次呼叫該函數,並且為 window 參數指定相同的名稱,則仍會使用相同的隨機字串。


擲回值
IOError request 物件的 digest 屬性不是 null。只有在載入 SWZ 檔 (Adobe 平台組件) 過程中用於呼叫 URLLoader.load() 方法時,才需設定 URLRequest 物件的 digest 屬性。
 
SecurityError — 在 Flash Player (以及 Adobe AIR 的非應用程式安全執行程序內容中),這項錯誤會在下列情況下擲出:
  • 本機不受信任的 SWF 檔可能無法與網際網路進行通訊。您可以透過將此 SWF 檔重新分類為「具有網路連線的本機」或受信任,避免此情況。
  • 瀏覽作業嘗試評估以程式碼編寫的虛擬 URL,不過內含的文件 (通常是指瀏覽器中的 HTML 文件) 是來自您無法存取的安全執行程序。 您可以在內含文件中指定 allowScriptAccess="always",避免此情況發生。
  • 當 HTML 檔與 SWF 檔的網域不符時,如果 SWF 檔包含在 allowScriptAccess 設定為 "none""sameDomain" 的 HTML 網頁中,您就無法瀏覽特定視窗 "_self""_top""_parent"
  • 您無法從位於本機與系統檔案安全執行程序中的 SWF 檔,瀏覽具有非預設名稱的視窗。
  • 您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」
 
Error — 如果不是為了回應使用者的動作 (例如滑鼠事件或按下按鍵事件) 而呼叫方法。這項需求只會套用至 Flash Player 的內容以及 Adobe AIR 的非應用程式安全執行程序內容。

更多範例

相關 API 元素


範例  ( 如何使用本範例 )

下列範例會在新的瀏覽視窗中開啟 http://www.adobe.com 這個 URL,並將有關使用者工作階段的資料 (在 URLVariables 物件中捕捉) 傳遞給網路伺服器。
package {
    import flash.display.Sprite;
    import flash.net.navigateToURL;
    import flash.net.URLRequest;
    import flash.net.URLVariables;

    public class NavigateToURLExample extends Sprite {

        public function NavigateToURLExample() {
            var url:String = "http://www.adobe.com";
            var variables:URLVariables = new URLVariables();
            variables.exampleSessionId = new Date().getTime();
            variables.exampleUserLabel = "Your Name";
            var request:URLRequest = new URLRequest(url);
            request.data = variables;
            try {            
                navigateToURL(request);
            }
            catch (e:Error) {
                // handle error here
            }
        }
    }
}

下列範例說明您如何使用 navigateToURL() 方法從 Flash Player 開啟新的瀏覽器視窗。範例由 ActionScriptExamples.com 提供。
// Requires
// - Button symbol on Stage (or a display object, such as a MovieClip) with instance name "buttonSymbol"
//
buttonSymbol.addEventListener(MouseEvent.CLICK, buttonSymbol_click);
 
function buttonSymbol_click(evt:MouseEvent):void {
    var req:URLRequest = new URLRequest("http://www.adobe.com/");
    navigateToURL(req, "_blank");
}

下列範例會說明使用特定數字啟動裝置電話撥號程式的語法。
var request:URLRequest = new URLRequest( "tel:+5555555555" );
navigateToURL( request );

下列範例會說明使用特定收件者啟動裝置文字訊息應用程式的語法。
var request:URLRequest = new URLRequest( "sms:+5555555555" );
navigateToURL( request );

下列範例會說明啟動 Android Market 應用程式的語法。搜尋參數會設定為尋找 Flash Player 應用程式。
var request:URLRequest = new URLRequest( "market://search?q=pname:com.adobe.flashplayer" );
navigateToURL( request );

registerClassAlias

()函數 
public function registerClassAlias(aliasName:String, classObject:Class):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0, Flash Player 9, Flash Lite 4

當物件以 Action Message Format (AMF) 編碼時,會保留該物件的類別 (類型)。 當您將物件編碼成 AMF 時,這個函數就會儲存其類別的別名,以便解碼物件時可以復原此類別。 如果編碼內容並未註冊物件之類別的別名,此物件就會編碼成匿名物件。 同樣地,如果解碼內容並未註冊相同的別名,就會針對解碼資料建立匿名物件。

LocalConnection、ByteArray、SharedObject、NetConnection 和 NetStream 都是以 AMF 編碼物件的類別範例。

編碼和解碼內容不需要針對別名使用相同的類別。如果目標類別包含來源類別序列化的所有成員,它們就可以根據目的來變更類別。

參數

aliasName:String — 要使用的別名。
 
classObject:Class — 與指定別名相關聯的類別。


擲回值
TypeError — 如果任一個參數為 null 的話。

相關 API 元素


範例  ( 如何使用本範例 )

這個範例會使用 registerClassAlias() 函數為類別 ExampleClass 註冊一個別名 (com.example.eg)。 由於是為類別註冊別名,因此就能將物件還原序列化成 ExampleClass 的實體,而程式碼也會輸出 true。 如果將 registerClassAlias() 呼叫移除,程式碼就會輸出 false
package {
    import flash.display.Sprite;
    import flash.net.registerClassAlias;
    import flash.utils.ByteArray;

    public class RegisterClassAliasExample extends Sprite {
        public function RegisterClassAliasExample() {
            registerClassAlias("com.example.eg", ExampleClass);
            var eg1:ExampleClass = new ExampleClass();
            var ba:ByteArray = new ByteArray();
            ba.writeObject(eg1);
            ba.position = 0;
            var eg2:* = ba.readObject();
            trace(eg2 is ExampleClass); // true
        }
    }
}

class ExampleClass {}

sendToURL

()函數 
public function sendToURL(request:URLRequest):void

語言版本: ActionScript 3.0
執行階段版本: AIR 1.0, Flash Player 9, Flash Lite 4

會將 URL 要求傳送至伺服器,但忽略任何回應。

若要檢查伺服器回應,請改用 URLLoader.load() 方法。

您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」

您可以拒絕 SWF 檔使用這個方法,方式是在包含 SWF 內容的 HTML 網頁中,設定 objectembed 標籤的 allowNetworking 參數。

在 Flash Player 10 和更新版本中,如果您使用包含上載 (由 POST 主體中 "content-disposition" 檔頭的 "filename" 參數指示) 的多部分 Content-Type (例如 "multipart/form-data"),POST 作業會受限於上載所套用的安全性規則:

  • 必須執行 POST 作業,以回應使用者啟動的動作 (例如按下滑鼠或按下按鍵)。
  • 如果 POST 作業會跨越網域 (POST 目標與傳送 POST 要求的 SWF 檔不在同一部伺服器上),目標伺服器必須提供允許跨網域存取的 URL 原則。

此外,多部分的 Content-Type 語法必須有效 (符合 RFC2046 標準)。如果語法無效,POST 作業會受限於上載所套用的安全性規則。

如需安全性詳細資訊,請參閱「Flash Player 開發人員中心」主題:安全性

參數

request:URLRequest — URLRequest 物件,指定要做為資料傳送目標的 URL。


擲回值
SecurityError — 本機不受信任的 SWF 檔無法與網際網路進行通訊。 您可以透過將此 SWF 檔重新分類為「具有網路連線的本機」或受信任,避免此情況。
 
SecurityError — 您不可以連接到常用的保留連接埠。完整的封鎖連接埠清單,請參閱在「ActionScript 3.0 開發人員指南」中的「限制網路 API」

範例  ( 如何使用本範例 )

下列範例會將有關使用者工作階段 (在 URLVariables 物件中捕捉) 的資料傳遞給位於 http://www.yourDomain.com/application.jsp 的應用程式。
 package {
    import flash.display.Sprite;
    import flash.net.URLRequest;
    import flash.net.URLVariables;
    import flash.net.sendToURL;

    public class SendToURLExample extends Sprite {

        public function SendToURLExample() {
            var url:String = "http://www.yourDomain.com/application.jsp";
            var variables:URLVariables = new URLVariables();
            variables.sessionId = new Date().getTime();
            variables.userLabel = "Your Name";

            var request:URLRequest = new URLRequest(url);
            request.data = variables;
            trace("sendToURL: " + request.url + "?" + request.data);
            try {
                sendToURL(request);
            }
            catch (e:Error) {
                // handle error here
            }
        }
    }
}

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

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