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

Drag and Drop guys... 2

Status
Not open for further replies.

coldfused

Technical User
Jan 27, 2001
2,442
US
Ok so say I have a small pic in a clip. I want to be able to take that clip and drag it to a certain area, when released over that certain area it opens up as a bigger picture.

Ok more clearly I guess. I am going to have six small pics in there own clips on the right hand side of a movie. User can take either one of the clips and drop it onto any of one of four areas set up for placement. Once dropped it becomes the larger version of the pic in the area it was dropped into. And the small pic returns to it's place.

What I am trying to build is a custom brochure cover builder. When one of the clients users logs into a certain area they will be able to create there own version of a company brochure to be printed for internal training brochures and what not. There will be six pics for them to choose from. But only four areas set aside to drop pics into. Also there will be two areas to ad text. Once they have placed there images and written there copy they will be able to print this to a ink jet or something to that effect.

BillWatson gave me some direction to go, espescially hiding unwanted areas when ready to print.

But i need some help with the scripting.

Can one of you guys show me a sample script that will drag and drop a smaller clip into a targeted area, once drops it pulls from another clip with a larger image and places that image. And the small clips returns to its area.

If any one has time that would be great,

---------------------------------------------
 
Ewan that's beautiful, thank you very much.

One quick question, how would I modify to have four possible droptargets?

And from the action script I can tell how the clips are being attached when dropped on the target, but how do the small clips no which jpg they are pulling in, is it just from there id of being 1,2,3,4,5,6? So does smallclip1 know to pull small .jpg1 just because of th number 1?

Thanks again.

---------------------------------------------
 
That's pretty much it - the id property holds the number needed to load in the right images. I'll have a look at your file and see what we have...
 
Try this, just drop it in in place of the existing code and rename the droptargets as 'drop1' thru 'drop4':

Code:
for (var i = 1; i<7; i++) {
	clip = this['small'+i];
	clip.loadPoint.attachMovie('thumb'+i, 'thumb'+i, i);
	clip.id = i;
	clip.x = clip._x;
	clip.y = clip._y;
	clip.onPress = function() {
		this.startDrag(false);
	};
	clip.onRelease = function() {
		this.stopDrag();
		for (var i = 1; i<5; i++) {
			if (_root['drop'+i].hitTest(_xmouse, _ymouse, true)) {
				_root['drop'+i].loadPoint.attachMovie('big'+this.id, 'bigPic', 10);
			}
		}
		this._x = this.x;
		this._y = this.y;
	};
}
// 
stop();
 
Ewan thats perfect thanks.

I have one more question. i want to add the pic navigation and the print movie button on the right into a movie clip so the user can drag that window down to add there pictures. if they are at 800x600 they will not be able to add pics to the bottom once they get to that row, see what I mean?

So if I add the small pics into a draggable clip they no longer work, due to the path I assume.

How do I change that code to point to a navigation_holder clip, so I can make the pics accessible as they go down the page, I'm guessing just making the small pic nav draggable will due, what do you think?

---------------------------------------------
 
I've mailed a new .fla through to you which should do the trick.
 
Just a note of appreciation to wangbar...

Very nice!

Synth
 
could i also get a copy of the fla?
jason_havelock@yahoo.ca
 
I'm having a similar problem, would it be possible to get a copy of the .fla also, I would truly appreciate it - thankyou!

Danny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top