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

NativeDragManager  - 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.desktop
public class NativeDragManager
继承NativeDragManager Inheritance Object

运行时版本: AIR 1.0

NativeDragManager 类协调拖放操作。使用本机拖放 API 可以使用户在 AIR 应用程序和本机操作系统之间、两个应用程序之间以及一个应用程序内不同组件之间拖动数据。

可以传输以下几种数据:

  • 位图
  • 文件
  • 文本
  • URL 字符串
  • 序列化对象
  • 对象引用(仅在源应用程序内有效)

注意:所有 NativeDragManager 成员都是静态的。不需要创建此类的实例。

拖放操作是一种用户界面手势,从用户单击某一可见项并将其拖动到别处开始。在执行拖动手势期间,当手势越过 AIR 应用程序窗口时,显示列表上的交互式对象将调度本机拖动事件。这些事件的处理函数可以调用 NativeDragManager 类的方法,以表示是否可以在对象上放置拖动项。作为响应,NativeDragManager 会更改鼠标指针以向用户提供反馈。

AIR 配置文件支持:AIR for TV 设备不支持此功能。所有移动设备上也不支持它。您可以使用 NativeDragManager.isSupported 属性在运行时测试是否受支持。有关在多个配置文件之间支持 API 的详细信息,请参阅 AIR 配置文件支持

拖动动作

拖放手势通常用于三种类型的操作,这些操作称为动作。由于这些动作的含义取决于应用程序的上下文,因此,运行时不会针对动作强制执行任何特定行为。不过,适当地实现这些动作会改善用户使用应用程序时的体验。

可能的动作包括:

  • 复制 -- 制作数据的副本,保持原始数据不变。(当在应用程序内拖动对象时,应该注意复制原始对象本身,而不要复制对该对象的引用。)
  • 移动 -- 将数据从其原始上下文中移动到由放置目标定义的上下文中,比如将一个项目从一个列表移动到另一个列表中。
  • 链接 -- 创建对原始数据的引用或原始数据的快捷方式,将项目保留在其原始上下文中。

通过在开始拖动操作的 NativeDragManager.doDrag() 调用中提供 allowedActions 参数,可以为拖动手势设置允许的动作。如果未提供 allowedActions 参数,则允许所有动作。潜在的拖动目标可以使用 NativeDragEvent 对象的 allowedActions 属性来检查哪些动作是允许的,并且不应接受仅允许不兼容动作的拖动(但运行时并不强制执行这一点)。

如果拖动目标只实现一个动作,则此对象可以设置 nativeDragEnternativeDragOver 事件处理函数中的 NativeDragManager 的 dropAction 属性。拖动之前设置该属性将允许拖动管理器更新鼠标指针,以表示支持的动作并防止用户使用功能键选择不兼容的动作。如果指定的动作不是允许的动作之一,则不允许拖动,即使目标调用 acceptDrop() 方法。

在接受拖动时,潜在的拖动目标应通过设置 NativeDragManager.dropAction 属性以响应 nativeDragDrop 事件来指定所选的动作。此动作将被报告回 nativeDragComplete 事件中的启动显示对象。如果拖动目标未设置动作,则会从允许的动作中选择一个默认动作,这些动作的优先顺序为:复制、移动、链接。启动对象负责更新其内部状态以响应所选的动作。

用作动作名称的字符串常量在 NativeDragActions 类中定义。

事件序列

拖动手势从调用 mouseDownmouseMove 事件处理函数内的 NativeDragManager.doDrag() 方法开始,然后继续执行以下事件序列以响应用户动作:

  • nativeDragStart 事件 -- 在调用 NativeDragManager.doDrag() 时,作为参数传递给该方法的交互式对象将成为启动器对象,并调度 nativeDragStart 事件。
  • nativeDragUpdate 事件 -- 在执行拖动时,启动器对象将继续调度 nativeDragUpdate 事件。
  • nativeDragEnternativeDragOver 事件 -- 当拖动手势越过交互式对象时,该对象将调度 nativeDragEnter 事件。当拖动手势停留在交互式对象上时,该对象将继续调度 nativeDragOver 事件。在响应这些事件中的任一事件时,作为潜在放置目标的对象应检查事件对象的属性,以确定它是否可以接受放置。如果数据格式和允许的动作适当,则这些事件的事件处理函数必须调用 NativeDragManager.acceptDrop(),传入对将作为拖动目标的显示对象(通常是调度 nativeDragEnternativeDragOver 事件的对象)的引用。然后用户可以将拖动项拖动到目标上。
  • nativeDragExit 事件 -- 当拖动手势移出交互式对象时,该对象将调度 nativeDragExit 事件。如果先前对 NativeDragManager.acceptDrop() 方法的调用已经将该对象指定为拖动目标,该调用将不再有效,如果手势再次进入交互式对象,则必须再次调用 acceptDrop()
  • nativeDragDrop 事件 -- 当用户在目标显示对象上松开鼠标按键时,该对象将调度 nativeDragDrop 事件。此事件的处理函数可以访问该事件对象的 transferable 属性中的数据,并应设置 NativeDragManager.dropAction 属性以表示启动器对象应采取哪种动作。
  • nativeDragComplete -- 当用户在拖动手势结束并释放鼠标时,启动器对象将调度 nativeDragComplete 事件(无论放置本身是否已完成)。此事件的处理函数可以检查事件对象的 dropAction 属性以确定应该对其内部数据状态进行何种修改(如果有),比如从列表中删除已拖动出去的项目。如果 dropActionNativeDragActions.NONE,则拖动项目没有放到符合条件的目标上。

应用程序之间的手势

当拖动手势从非 AIR 应用程序进入 AIR 应用程序窗口时,不会有启动器对象调度 nativeDragStartnativeDragComplete 事件。在该手势期间调度的事件将遵循与在同一 AIR 应用程序内开始和结束的手势相同的模式。

当拖动手势离开 AIR 应用程序窗口时,不会有目标对象调度 nativeDragEnternativeDragOvernativeDragDrop 事件。启动器对象仍将调度 nativeDragComplete 事件,该事件会报告由本机操作系统设置的拖动动作(如果不接受放置,则报告 none)。

如果拖动手势从一个 AIR 应用程序移动到另一个 AIR 应用程序,启动器和目标显示对象将照常在其各自的应用程序内调度事件。

传输信息

在拖放手势期间传输的数据包含在 Clipboard 对象中。此数据对象是使用启动拖动手势的 NativeDragManager.doDrag() 方法添加到拖动操作中的。潜在的放置目标可以通过本机拖动事件对象的 clipboard 属性访问 Clipboard 对象。一旦拖动操作开始后,只能在 NativeDragEvent 的事件处理函数中访问 Clipboard 对象。对该对象的任何其它访问尝试都将生成运行时错误。

安全注意事项

启动器和潜在目标对象的安全沙箱确定可以何种方式访问所拖动的数据。如果两个对象在同一个沙箱中,则可以从任一 NativeDragEvent 对象访问数据。不过,如果启动器和目标对象在不同的沙箱中,则只能在 nativeDragDrop 事件的事件处理函数内的目标沙箱中访问数据。其它本机拖动事件处理函数仍然可以访问事件的 clipboard 属性中所引用的 Clipboard 对象,以确定可以使用哪些数据格式,但调用 clipboard.getData() 方法会生成安全错误。

相关 API 元素



公共属性
 属性由以下参数定义
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
      dragInitiator : InteractiveObject
[静态] [只读] 传递给启动拖动操作的 NativeDragManager.doDrag() 调用的交互式对象。
NativeDragManager
      dropAction : String
[静态] 放置目标指定的拖动操作。
NativeDragManager
      isDragging : Boolean
[静态] [只读] 报告拖动操作当前是否正在进行中。
NativeDragManager
      isSupported : Boolean
[静态] [只读] 如果当前平台支持 NativeDragManager 类,则 isSupported 属性设置为 true,否则设置为 false。
NativeDragManager
公共方法
 方法由以下参数定义
  
[静态] 通知 NativeDragManager 对象:指定的目标交互式对象可以接受与当前拖动事件对应的放置。
NativeDragManager
  
    doDrag(dragInitiator:InteractiveObject, clipboard:Clipboard, dragImage:BitmapData = null, offset:Point = null, allowedActions:NativeDragOptions = null):void
[静态] 启动拖放操作。
NativeDragManager
 Inherited
表示对象是否已经定义了指定的属性。
Object
 Inherited
表示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
表示指定的属性是否存在、是否可枚举。
Object
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。
Object
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
属性详细信息
    

dragInitiator

属性
dragInitiator:InteractiveObject  [只读]

运行时版本: AIR 1.0

传递给启动拖动操作的 NativeDragManager.doDrag() 调用的交互式对象。



实现
    public static function get dragInitiator():InteractiveObject
    

dropAction

属性 
dropAction:String

运行时版本: AIR 1.0

放置目标指定的拖动操作。

dropAction 属性应该在 nativeDragDrop 事件的处理函数中设置。如果在 nativeDragComplete 之前未设置 dropAction,则 NativeDragManager 将用列表中允许的第一个动作设置此值:复制、移动或链接(按此顺序)。



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

相关 API 元素

    

isDragging

属性 
isDragging:Boolean  [只读]

运行时版本: AIR 1.0

报告拖动操作当前是否正在进行中。



实现
    public static function get isDragging():Boolean
    

isSupported

属性 
isSupported:Boolean  [只读]

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

如果当前平台支持 NativeDragManager 类,则 isSupported 属性设置为 true,否则设置为 false



实现
    public static function get isSupported():Boolean
方法详细信息

    acceptDragDrop

()方法
public static function acceptDragDrop(target:InteractiveObject):void

运行时版本: AIR 1.0

通知 NativeDragManager 对象:指定的目标交互式对象可以接受与当前拖动事件对应的放置。

只有在指定目标对象上具有可处理拖动项中至少一种数据格式和至少一种允许动作的 nativeDragDrop 处理函数时,才应该调用此方法。

只能在 nativeDragEnternativeDragOver 事件处理函数内调用此函数。

参数

target:InteractiveObject

    doDrag

()方法 
public static function doDrag(dragInitiator:InteractiveObject, clipboard:Clipboard, dragImage:BitmapData = null, offset:Point = null, allowedActions:NativeDragOptions = null):void

运行时版本: AIR 1.0

启动拖放操作。

启动拖动操作:

  1. 创建一个新的 Clipboard 对象。
  2. 以一种或多种格式添加要传输的数据。
  3. 或者,创建一个 BitmapData 对象作为拖动期间的代理图像。
  4. 或者,创建一个 NativeDragOptions 对象以限制此操作中允许的动作。(如果 allowedActions 参数保留为 null,则允许所有动作。)
  5. 调用 NativeDragManager.doDrag()

启动器对象在调用此方法后将调度一个 nativeDragStart 事件,在拖动进行过程中将调度几个 nativeDragStart 事件,而当用户释放鼠标按钮以结束拖动手势时将调度一个 nativeDragComplete 事件。nativeDragComplete 事件的处理函数可以检查该事件的 dropAction 属性以确定拖放操作是否成功完成。如果 dropActionNativeDragActions.NONE,则拖动项目没有放到符合条件的目标上。

只能从 mouseDownmouseMove 事件处理函数内调用此方法。(如果在响应 mouseMove 事件时调用,鼠标按钮也必须处于按下状态。)

参数

dragInitiator:InteractiveObject — 通常是从中开始拖动手势的对象。接收 nativeDragStartnativeDragComplete 事件。
 
clipboard:Clipboard — 所拖动数据的容器对象。
 
dragImage:BitmapData (default = null) — 在拖动手势期间在鼠标指针下显示的可选代理图像。如果为 null,则不显示任何图像。
 
offset:Point (default = null) — 鼠标热点和拖动图像左上角之间的偏移。负坐标会将图像相对于该热点向上和向左移动。如果为 null,拖动图像的左上角将位于鼠标热点。
 
allowedActions:NativeDragOptions (default = null) — 限制此操作允许的拖放动作。如果为 null,则允许所有动作。

相关 API 元素





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

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