dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [F8] Dragging and Snapping help!

  1. #1
    Hopefully not THAT incompetent
    Join Date
    Jun 2006
    Location
    Vancouver, BC, Canada
    Posts
    13

    [F8] Dragging and Snapping help!

    Hey!

    Alright I'm making a little dressup game for my friend and I'm having some slight issues. I want the clothing to snap to where it's supposed to be when they stop dragging and all the tutorials I've found seem to make it way more complicated then it needs to be...

    So far I have this:
    Code:
    origX = red._x;
    origY = red._y;
    red.onPress = function() {
    	this.startDrag();
    }
    red.onRelease = function() {
    	this.stopDrag();
    	if (eval(this._droptarget) == reset) {
    		this._visible = false;
    		this._x = origX;
    		this._y = origY;
    	}
    	if (eval(this._droptarget) == target) {
    		this._x = 385.0;
    		this._y = 145.0;
    	}
    }
    
    origX = orange._x;
    origY = orange._y;
    orange.onPress = function() {
    	this.startDrag();
    }
    orange.onRelease = function() {
    	this.stopDrag();
    	if (eval(this._droptarget) == reset) {
    		this._visible = false;
    		this._x = origX;
    		this._y = origY;
    	}
    	if (eval(this._droptarget) == target) {
    		this._x = 385.0;
    		this._y = 145.0;
    	}
    }
    The part I'm having trouble with is
    Code:
    if (eval(this._droptarget) == target) {
    		this._x = 385.0;
    		this._y = 145.0;
    	}
    This only works for one piece at a time. If red is on the target then orange won't snap to it and vice versa. Since it's a dressup game it's going to have more than one piece snapped on it. Is there a way I can do this without making a couple hundred different targets?

    Thanks!!

  2. #2
    Hopefully not THAT incompetent
    Join Date
    Jun 2006
    Location
    Vancouver, BC, Canada
    Posts
    13
    huh... so there's no easy way to do a snap? Please? I'm completely lost...

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