Chapter 34. Drag and Drop in Flex

This chapter examines the capabilities in the Flex framework for dragging and dropping entities from one area of an application to another. The items covered are as follows:

  • Working with the drag and drop-enabled components

  • Working with drag and drop events

  • Adding drag and drop to nonenabled components

  • Additional drag and drop tips

Overview

Dragging and dropping is a very natural way for a user to interact with a modern graphical user interface. Drag and drop support is built into modern operating systems such as Windows and Mac OS. Some of the use cases that come to mind when talking about drag and drop in a modern operating system include:

  • Dragging an item such as an audio file, image, or video file onto a player or viewer.

  • Relocating an item between two different item groups. For instance, you might use classroom management software to drag and drop a student record from one classroom roster to another.

  • Deleting an item by dragging it onto a trash can icon.

  • Rearranging your UI preferences by dragging and dropping around the various display components.

As you can see, dragging and dropping is something that is used very extensively these days, and luckily, drag and drop was factored into the Flex framework. Let's start by taking a look at the components that natively support drag and drop.

Working with Drag and Drop-Enabled Components

Fortunately for you as a Flex developer, there are a number of components that support drag and drop right out of the box. ...

Get Professional Adobe® Flex® 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.