Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making images snap to a position. 1

Status
Not open for further replies.

jezx

Technical User
Jul 15, 2002
18
0
0
GB
How do I make an image be dragable to a space and then when dropped it snaps to the space.
I want to be able to do this with a series of images in a quiz so that when you have the images arranged in the right order it tells you it is correct.
 
Inside your MC have a button with the following actions:

Code:
on (press) {
	startDrag("");
}
on (release, dragOut) {
	stopDrag();
	if (_root.pic.hittest(_root.hit_pic)) {
		_root.pic._x = 273;
		_root.pic._y = 210;
	} else {
		_root.pic._x = _root.x_pic;
		_root.pic._y = _root.y_pic;
	}
}

hit_pic would be the instance name of the MC that you want to be the drop area.

This code's a bit messy. You might want to change _root.pic to this.

Try it out.
 
i often thought 'bout that but it never came to my mind to do this with a hittest (poor poor little gambler brain) :)

anyway i really appreciate that solution!!

Here's a star * regards

Firegambler
 
thanks for that I'll give it a go
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top