jorishilhorst
06-22-2006, 02:42 PM
Hi,
I am trying to use the dragmanager with an element, but at the same time support onClick to allow the element to be selected. I'm not sure if this is flex2 specific (but am using the latest version)
in the attributes of the object I have put:
click="clickHandler(event)"
mouseDown="dragThumbnail(event)"
and inside the script block I have defined the following functions:
public function clickHandler(event:MouseEvent):void {
parentApplication.setSelectedPhone(this);
}
public function dragThumbnail(event:MouseEvent):void {
var ds:DragSource = new DragSource();
ds.addData(this, dragType);
DragManager.doDrag(IUIComponent(this), ds, event);
}
This works after a fashion, as the mouseclick gets caught, and on mousedown the canvas gets dragged around. However does anyone know how I can make sure the dragThumbnail method does not start in the case of a mouseclick?
The problem is that the drag action always starts (even on a regular mouseclick).
I was thinking of making a timer which polls or something but that seems like hacking to me. Anyone have any thoughts?
cheers,
joris
I am trying to use the dragmanager with an element, but at the same time support onClick to allow the element to be selected. I'm not sure if this is flex2 specific (but am using the latest version)
in the attributes of the object I have put:
click="clickHandler(event)"
mouseDown="dragThumbnail(event)"
and inside the script block I have defined the following functions:
public function clickHandler(event:MouseEvent):void {
parentApplication.setSelectedPhone(this);
}
public function dragThumbnail(event:MouseEvent):void {
var ds:DragSource = new DragSource();
ds.addData(this, dragType);
DragManager.doDrag(IUIComponent(this), ds, event);
}
This works after a fashion, as the mouseclick gets caught, and on mousedown the canvas gets dragged around. However does anyone know how I can make sure the dragThumbnail method does not start in the case of a mouseclick?
The problem is that the drag action always starts (even on a regular mouseclick).
I was thinking of making a timer which polls or something but that seems like hacking to me. Anyone have any thoughts?
cheers,
joris