Products
Technologies

Developer resources

How do you make a Spark custom itemRenderer with a non-embedded image that still shows on drag and drop in an AIR app?

Avg. Rating 5.0

Problem

I have 2 Spark lists and a custom itemRenderer extending from Spark ItemRenderer. I have an Image component in the renderer with its source set to a path property of the renderer's data property (xml, in this case). Works great until you try to drag from one list to the other. The default drag proxy fails to show the image during drag, though all other components in the renderer show up fine. The image only seems to show up during a drag if it is embedded. How can this be done if the image is not embedded?

Solution

Toggle the WindowedApplication in your AIR app to use DragManagerImpl rather than NativeDragManagerImpl.

Detailed explanation

Beginning with Flex SDK build 4.0.0.12222, WindowedApplication now has a new Boolean property called useNativeDragManager. This property is true by default in an AIR aplication. Setting useNativeDragManager to false causes the application to use DragManagerImpl, which uses the same rules as a Flex application for the browser. Your image will now show in the drag proxy and your drag indicator cursors will be the familiar green check and red x rather than the generic native indicator.


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes