用于 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 的标签
Motion 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 中,该函数在默认的系统 web 浏览器中打开一个 URL

重要安全提示

开发人员通常将获取自 FlashVars 等外部来源的 URL 值传递给 navigateToURL() 函数。攻击者可能会尝试操纵这些外部来源,以进行跨站脚本等攻击。因此,开发人员应该验证所有 URL,然后才能将其传递给此函数。

良好的 URL 数据验证蕴含着许多不同的技术,具体取决于 URL 在整个应用程序中的用法。最常用的数据验证技术包括了验证 URL 的方案是否适当。例如,无意中允许 javascript: URL 可能会导致跨站脚本攻击。验证 URL 位于您的域内可以确保进行仿冒攻击的人无法使用 SWF 文件作为 open 请求的重定向器。如要增强安全性,还可以验证 URL 的路径,并验证 URL 符合 RFC 指导原则。

例如,以下代码展示了一个执行数据验证的简单示例,其中拒绝不以 http:// 或 https:// 开头的任何 URL,并验证 URL 在您的域名范围内。此例可能并不适用于所有 Web 应用程序,因此您应该考虑是否需要针对 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 文件和包含该文件的 Web 页(如果有)位于受信任的本地安全沙箱时,才允许调用指定 "javascript:" 伪协议(通过作为第一个参数传递的 URLRequest 对象)的 navigateToURL() 方法。一些浏览器不支持通过 navigateToURL() 方法使用 javascript 协议。而应考虑使用 ExternalInterface API 的 call() 方法在包含该内容的 HTML 页中调用 JavaScript 方法。

在 Flash Player 和 Adobe AIR 中的非应用程序沙箱中,您无法连接常用的保留端口。有关已阻止的端口的完整列表,请参阅《ActionScript 3.0 开发人员指南》中的“限制网络 API”。

在浏览器中运行的 Flash Player 10 和更高版本中,以编程方式使用此方法打开弹出窗口可能不会成功。不同的浏览器(和浏览器配置)可能会随时阻止弹出窗口;不能保证可以显示任何弹出窗口。不过,为了尽可能成功,请仅在作为用户操作的直接结果执行的代码中使用此方法打开弹出窗口,例如,在鼠标单击或按键事件的事件处理函数中。

在 Flash Player 10 和更高版本中,如果使用包含上载(由 POST 体内的“content-disposition”标头中的“filename”参数表示)的 multipart Content-Type(例如“multipart/form-data”),则 POST 操作会受应用于上载的安全规则的约束:

  • 必须执行 POST 操作以响应用户启动的操作(如鼠标单击或按键)。
  • 如果 POST 操作是跨域的(POST 目标与发送 POST 请求的 SWF 文件不在同一台服务器上),则目标服务器必须提供一个允许跨域访问的 URL 策略文件。

另外,对于任何 multipart 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 — URLRequest 对象,指定要导航到哪个 URL。

对于在 Adobe AIR 中运行的内容,当使用 navigateToURL() 函数时,运行时将使用 POST 方法的 URLRequest(其 method 属性设置为 URLRequestMethod.POST)视为使用 GET 方法。

 
window:String (default = null) — 浏览器窗口或 HTML 帧,其中显示 request 参数表示的文档。可以输入某个特定窗口的名称,或使用以下值之一:
  • "_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 文件可能无法与 Internet 进行通信。要避免这种情况,可将此 SWF 文件重新分类为只能与远程内容交互或受信任。
  • 导航操作试图评估伪 URL 的脚本编写,但包含文档(通常是浏览器中的一个 HTML 文档)来自您不具有访问权限的沙箱。要避免这种情况,可以在包含文档中指定 allowScriptAccess="always"
  • 如果 SWF 文件包含在已将 allowScriptAccess 设置为 "none""sameDomain" 的 HTML 页中,而此 HTML 文件与 SWF 文件的域不匹配,将无法导航特殊窗口 "_self""_top""_parent"
  • 不能导航具有非默认名称的窗口,非默认名称来自位于 local-with-filesystem 沙箱中的 SWF 文件。
  • 无法连接到常用的保留端口。有关已阻止的端口的完整列表,请参阅《ActionScript 3.0 开发人员指南》中的“限制网络 API”。
 
Error — 为了响应用户动作(如鼠标事件或按键事件),将不会调用此方法。此要求仅适用于 Flash Player 中的内容和 Adobe AIR 中的非应用程序沙箱内容。

相关 API 元素


示例  ( 如何使用本示例 )

下例在一个新的浏览器窗口中打开 URL http://www.adobe.com,并将在 URLVariables 对象中所捕获的用户会话数据传递给 Web 服务器。
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 内容的 HTML 页中设置 objectembed 标签的 allowNetworking 参数,防止 SWF 文件使用此方法。

在 Flash Player 10 和更高版本中,如果使用包含上载(由 POST 体内的“content-disposition”标头中的“filename”参数表示)的 multipart Content-Type(例如“multipart/form-data”),则 POST 操作会受应用于上载的安全规则的约束:

  • 必须执行 POST 操作以响应用户启动的操作(如鼠标单击或按键)。
  • 如果 POST 操作是跨域的(POST 目标与发送 POST 请求的 SWF 文件不在同一台服务器上),则目标服务器必须提供一个允许跨域访问的 URL 策略文件。

另外,对于任何 multipart Content-Type,语法必须有效(根据 RFC2046 标准)。如果语法无效,则 POST 操作受应用于上载的安全规则约束。

有关安全性的详细信息,请参阅 Flash Player 开发人员中心主题:安全性

参数

request:URLRequest — URLRequest 对象,指定要将数据发送到哪个 URL。


引发
SecurityError — 本地不受信任的 SWF 文件无法与 Internet 通信。要避免这种情况,可将此 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 类显示为英语。