DragAndDrop.StartDrag 开始拖放

static function StartDrag (title : string) : void

Description描述

Start a drag operation.

开始一个拖放操作。

Initiates a drag operation with the current drag object state. Use paths and/or objectReferences to setup drag state.

初始一个拖拽操作,带有当前拖拽物体的状态。使用paths和/或objectReferences设置拖拽状态。

参见:StartDrag, paths, objectReferences.

function OnGUI () {
	if (Event.current.type == EventType.MouseDrag) {
		// Clear out drag data
		//清除拖放数据
		DragAndDrop.PrepareStartDrag ();

		// Set up what we want to drag
		//设置拖放物体
		DragAndDrop.paths = [ "/Users/joe/myPath.txt" ];

		// Start the actual drag
		//开始实际拖放
		DragAndDrop.StartDrag ("Dragging title");

		// Make sure no one uses the event after us
		//确保之后没有东西使用这个事件
		Event.current.Use();
	}
}
Page last updated: 2011-5-27