[flexcoders] Re: Custom Drag Cursors
Alex, Setting the cursor on mouseMove is not the problem...I get the correct cursor during mouseMove...the cursor comes from the move-cursor style of the DragManager. I am attempting to use these styles to get the functionality that I need. If I don't use the DragManager styles and attempt to set all of the cursors manually I can almost get it working. If I do it this way I have to turn off the cursor when the user ends the drag. This is simple if the user drops where I expect the drop to occur. But if the user drops to one of the many many unallowed areas I am not sure where to put the code that will remove my custom cursor without putting mouseUp listeners everywhere. Maybe there is a simple way to do this differently? If I use the DragManager's styles this happens automatically for me, plus I get the bonus of allowing the DragManager to show reject-cursor and others, which I do not want to change manually. So the problem for me right now is to show the correct cursor between mouseDown, which calls startDrag(), and mouseMove when the DragManager seems to take over and use it's stylesheet cursors. I tried setting my own cursor in mouseDown and then removing it in mouseMove, but this seems to mess up the DragManager and cause it to no longer use the custom cursors setup in it's stylesheet. --- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote: I'm not sure why you say you can't use setCursor() on mouseMove? Anyway, everything described in the original email seems ok. What is the mouseDown target? Did you try setting a cursor then? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sheriff Sent: Monday, October 15, 2007 10:39 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Custom Drag Cursors Are you using the cursorManager or just when a drag happens? u cant just use cursorManager.setCursor(...whatever u want) on mouse move - Original Message From: toofah_gm [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Monday, October 15, 2007 5:35:07 PM Subject: [flexcoders] Custom Drag Cursors I am trying to use my own custom cursor for drag and drop functionality and having a little trouble. I have added my own cursor to mouseOver on the object that is draggable... this is to indicate that the object is draggable. I have setup css style for all of the DragManager cursors like this: DragManager { copy-cursor: Embed(source= /assets/ images/copy. png); link-cursor: Embed(source= /assets/ images/link. png); move-cursor: Embed(source= /assets/ images/move. png); reject-cursor: Embed(source= /assets/ images/reject. png); } Now the trouble. When I hover I see my custom cursor. When I mouseDown I see the default cursor...this is the problem. When I start dragging I see my custom cursors. How do I see my custom cursor during the entire process? During mouseDown event I call DragManager. startDrag( ). If I do not clear my hover cursor, or if I set a different cursor, the custom drag cursors never show up. It seems that any set cursor overrides the drag ones. If I clear my hover cursor before I call startDrag(), the custom drag cursors do not show up until the first mouseMove. There is a window between mouseDown and mouseMove where I have no custom cursor. Any ideas? Am I missing something here? I guess that I can override the mouseMove event if I need to and clear it there if I have to. Thanks. Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel http://us.rd.yahoo.com/evt=48516/*http:/surveylink.yahoo.com/gmrs/yahoo _panel_invite.asp?a=7%20 and lay it on us.
[flexcoders] Re: Custom Drag Cursors
Here is some sample code that illustrates what I am doing. The commented out lines are some things that I have been trying that also do not help. Application: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute xmlns:ns1=* mx:Style DragManager { move-cursor: Embed(source=/assets/images/handDown.png); reject-cursor: Embed(source=/assets/images/handReject.png); } /mx:Style mx:List x=85 y=63 itemRenderer=dragObject mx:dataProvider mx:Object/ mx:Object/ mx:Object/ mx:Object/ mx:Object/ mx:Object/ mx:Object/ /mx:dataProvider /mx:List /mx:Application Renderer: ?xml version=1.0 encoding=utf-8? mx:Button xmlns:mx=http://www.adobe.com/2006/mxml; width=20 height=10 mouseDown=onMouseDown(event) mouseMove=onMouseMove(event) mouseOver=onMouseOver(event) mouseOut=onMouseOut(event) mx:Script ![CDATA[ import mx.managers.CursorManager; import mx.core.DragSource; import mx.managers.DragManager; [Embed(source=/assets/images/hand.png)] private var handCursor:Class; [Embed(source=/assets/images/handDown.png)] private var handDownCursor:Class; private function onMouseDown(event:MouseEvent):void { CursorManager.removeAllCursors(); // CursorManager.setCursor(handDownCursor); DragManager.doDrag(this, new DragSource(), event); } private function onMouseMove(event:MouseEvent):void { // if (DragManager.isDragging) // { // CursorManager.removeAllCursors(); // } } private function onMouseOver(event:MouseEvent):void { CursorManager.removeAllCursors(); CursorManager.setCursor(handCursor); } private function onMouseOut(event:MouseEvent):void { if (!DragManager.isDragging) { CursorManager.removeAllCursors(); } } ]] /mx:Script /mx:Button --- In flexcoders@yahoogroups.com, toofah_gm [EMAIL PROTECTED] wrote: Alex, Setting the cursor on mouseMove is not the problem...I get the correct cursor during mouseMove...the cursor comes from the move-cursor style of the DragManager. I am attempting to use these styles to get the functionality that I need. If I don't use the DragManager styles and attempt to set all of the cursors manually I can almost get it working. If I do it this way I have to turn off the cursor when the user ends the drag. This is simple if the user drops where I expect the drop to occur. But if the user drops to one of the many many unallowed areas I am not sure where to put the code that will remove my custom cursor without putting mouseUp listeners everywhere. Maybe there is a simple way to do this differently? If I use the DragManager's styles this happens automatically for me, plus I get the bonus of allowing the DragManager to show reject-cursor and others, which I do not want to change manually. So the problem for me right now is to show the correct cursor between mouseDown, which calls startDrag(), and mouseMove when the DragManager seems to take over and use it's stylesheet cursors. I tried setting my own cursor in mouseDown and then removing it in mouseMove, but this seems to mess up the DragManager and cause it to no longer use the custom cursors setup in it's stylesheet. --- In flexcoders@yahoogroups.com, Alex Harui aharui@ wrote: I'm not sure why you say you can't use setCursor() on mouseMove? Anyway, everything described in the original email seems ok. What is the mouseDown target? Did you try setting a cursor then? From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sheriff Sent: Monday, October 15, 2007 10:39 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Custom Drag Cursors Are you using the cursorManager or just when a drag happens? u cant just use cursorManager.setCursor(...whatever u