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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dragable Objects unlimited

Status
Not open for further replies.

killbuzz

Technical User
Mar 21, 2001
103
US
Okay, What i want to do is make a many dragable objects, but when you take one, the object stays in the place you took it from so you can drag more. WHat im trying to do is make a program that will allow me to use the same object over for many things with out having to make 50 of the same objects.


I need to know the code for draging, and if there is some way to do the unlimited objects....


thanks
 
Try this - you'll need a clip in the library with linkage set to 'clipToBeDuped':

Code:
clip = this.attachMovie('clipToBeDuped', 'clip', 0);
clip.onPress = function() {
	newClip = this.duplicateMovieClip('copy'+num, num);
	trace(newClip);
	newClip.startDrag(true);
	num++;
	this.onMouseUp = function() {
		newClip.stopDrag();
	};
};
_global.num = 1;
//
stop();
 
What do you mean, "library with linkage set to 'clipToBeDuped'" I dont understand?

Also what do i name the clip? Or what was the name of the clip in this code so i can change that because im using a lot of objects..

Thanks wang
 
Build your clip in the normal way. Select the symbol in the library and right click - select 'linkage' from the menu which pops up - check 'export for actionscript' and then type in the name 'clipToBeDuped' where it says 'Identifier'.

This means the clip can be used in the movie via the 'attachmovie' command - you don't actually need to place the clip on the stage manually, the actionScript above will do it for you.

Then the above script should work for you. It's important to use attachMovie in this example to bring in the clip as it means you can use 'duplicateMovieClip' to create copies of it.
 
That isnt working I have it as a movieclip thats right? I copy and pasted all the info you put and done the linkage, I have a bunch of objects i want to do i have only tryed it with one. doesnt work..

I put the code on the object action scrip right? Thats what i done..



What am I doing wrong?
 
What's your email? I'll send you a working version and you should be able to figure it out from there.
 
Wangbar, i sent you a reply back on a question with my file so you can understand it better..


Thanks for the file it helped me out a lot


YOUR A GOOD MAN!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top