Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual page 180

Migrating applications to flex 2
Table of Contents

Advertisement

Other issues
In addition to the changes shown here, you might also encounter the issues described in this
section when you convert drag-and-drop code.
Accessing event targets
Because a TextArea control uses a Flash TextField control, and mouse events are dispatched by
Flash Player, not Flex, you must use the
property in the
doDrag()
Detecting keys
Because ActionScript no longer has a Key class, and the Keyboard class replaces a limited set
of the Key class's functionality, three new Boolean properties,
, were added to the DragEvent object. The new properties represent these keys' states
AltKey
when the user drags an item over a drop target. Typically, when a user holds the Shift,
Control, or Alt key down during a drag-and-drop operation, the user wants to change the
default behavior of the dragged item.
The following example checks if the user is pressing the Control key when dragging over the
target (to copy data), and sets the action in the DragManager to reflect its state.
Flex 1.5:
private function doDragOver(event:Event) {
event.target.showDropFeedback(event);
if (Key.isDown(Key.CONTROL)) {
...
} else if (Key.isDown(Key.SHIFT)) {
...
}
}
Flex 2:
private function doDragOver(event:DragEvent) {
event.target.showDropFeedback(event);
if (event.ctrlKey) {
...
} else if (event.shiftKey) {
...
}
}
180
Migration Patterns
currentTarget
method when you start a drag from a TextArea control.
property instead of the
,
ctrlKey
shiftKey
target
, and

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents