A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Drag & Drop doesn't work well in CS6

  1. #1
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971

    Drag & Drop doesn't work well in CS6

    Hey guys! I installed Adobe Master Collection CS6 today, only for Flash CS6, and I was about to keep working in my game...but weirdly all my draggable buttons are crazy!

    In CS3 and CS5 , my game works perfectly, but not in CS6. You drag any movieclip with X coordinates locked to an empty movieclip's width, and It drags X and Y!!! My movieclips are supposed to be dragged horizontally only.

    This is my code:

    Actionscript Code:
    ladder.onPress=function(){
        this.startDrag(false, contenedor._width );
       
    }
    ladder.onRelease=function(){
        this.stopDrag();
       
    }


    What's new ( or changed, bah! ) in Flash CS6? Thanks

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Maybe you need to specify all parameters?

    Actionscript Code:
    this.startDrag(false, contenedor._width, this._y, ???, this._y);

    Just replace ??? with what you want to be the most RIGHT-side limit. See if that works, just my 2 cents
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

  3. #3
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I "weirdly" fixed it this way:

    Actionscript Code:
    windowMC.windoW.startDrag(false, 144,0,0, 0 );


    So, what would be the way to "constraint" the drag to an empty movieclip's coordinates? In flash CS3 and CS5 I used to make it this way:

    Actionscript Code:
    windowMC.windoW.startDrag(false, emptyMovieclip._width );
    And in an onEnterFrame detects the X coordinates to do whatever action:

    Actionscript Code:
    onEnterFrame=function(){
    if(windowMC.windoW._x <= 32){    //if the windows X is before or in X=32

    windowMC.windoW._x=32;    //force the movieclip to stay in X= 32                                                            
                                               //and not move
    DO ANOTHER ACTION;

    }
    }

    Thanks

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Um, you could use getBounds(), which retrieves the most left and right X position of a movieclip and also the most top and bottom Y position of the same movieclip:

    Actionscript Code:
    b = emptyMovieclip.getBounds(this);
    windowMC.windoW.startDrag(false, b.xMin, b.yMin, b.xMax, b.yMax);

    If that doesn't work, try this:

    Actionscript Code:
    b = emptyMovieclip.getBounds(windowMC.windoW);
    windowMC.windoW.startDrag(false, b.xMin, b.yMin, b.xMax, b.yMax);
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

Tags for this Thread

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