A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Drag and Drop conflict with Mouse?

Hybrid View

  1. #1
    Senior Member
    Join Date
    May 2009
    Posts
    280

    Unhappy Drag and Drop conflict with Mouse?

    Hey Flashkit!

    What i'm trying to do is make a drag able square and use a different cursor that I made to do so. It worked fine until I added the code for the cursor. Help?

    PHP Code:
    //Creating the Rectangle
    var imgWidth:Number=rec.width;
    var 
    imgHeight:Number=rec.height;
    var 
    rectWidth:Number=bg.width;
    var 
    rectHeight:Number=bg.height;
    var 
    rectX:Number=bg.x;
    var 
    rectY:Number=bg.y;
    var 
    boundWidth=rectWidth-imgWidth;
    var 
    boundHeight=rectHeight-imgHeight;
    var 
    boundsRect:Rectangle=new Rectangle(rectX,rectY,boundWidth,boundHeight);
    //-----------------------------------------------------------------------------------------------------------
    rec.addEventListener(MouseEvent.MOUSE_DOWNDragWindow1); //Conflict?
    function DragWindow1(event:MouseEvent):void
    {
        
    rec.startDrag(falseboundsRect);
    }
    //-----------------------------------------------------------------------------------------------------------
    rec.addEventListener(MouseEvent.MOUSE_UPDropWindow1);
    rec.addEventListener(MouseEvent.MOUSE_OUTDropWindow1);
    function 
    DropWindow1(event:MouseEvent):void
    {
        
    rec.stopDrag();
    }
    //-----------------------------------------------------------------------------------------------------------

    //CURSOR
    stage.addEventListener(MouseEvent.MOUSE_MOVEredrawCursor); //Conflict?
    stage.addEventListener(Event.MOUSE_LEAVEhideCursor);
    Mouse.hide();

    function 
    redrawCursor(event:MouseEvent):void
    {
        
    myCursor_mc.visible=true;
        
    myCursor_mc.x=event.stageX;
        
    myCursor_mc.y=event.stageY;
    }

    function 
    hideCursor(event:Event):void
    {
        
    myCursor_mc.visible=false;


  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    set mouseEnabled = false on myCursor_mc. It is catching all the mouse events.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center