I have a drag and drop handler in my Flex application. The drag proxy, or the 'ghost' image to be displayed while dragging, must be loaded before I drag, and that takes some time. How can I make it load immediately or preload? One solution is to duplicate the image, but as far as I know, image objects can't be duplicated without creating another variable, which must still take some time to load.
Perhaps this code will illustrate it better:
public function DragApp (e : MouseEvent) : void {
var dragInitiator : Image = e.currentTarget as Image;
var dragSource : DragSource = new DragSource ();
var dragProxy : Image = new Image ();
dragProxy.source = e.currentTarget.source; // Won't work unless image is embedded
dragProxy.load (e.currentTarget.source); // Must load
setTimeout (DragManager.doDrag, 350, dragInitiator, dragSource, e, dragProxy);
}