Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Drag And Drop - When Drop Targets Overlap



Hi,

Please see
http://www.paraminionstudios.com/dump/PleaseHelp.zip for the files I'm requestiong help on (upload tool is not working).

Drag and drop the power generator "icons" on the left of the screen into the designated areas in the 3d scene to "install" power generators along the side of the building.

I have 4 designated regions in a 3d rendered scene. there are 4 dragable power generator "icons" on the far left of the screen. When the generator icons are dragged and dropped upon one of the 4 targets, the target mc advances to frame 2 of the target mc, and the generator icon disappears (actually the generator icon mcs simply advance to frame 2 of the mc.. a blank kframe). Frame 2 of each of the targets contains a small graphic of a generator that fits the perspective of the 3d scene.

my problem here is that my target MCs overlap slightly. This is causing some issues. if you have already "installed" generator 1, and you then go to drag another icon just below target1, flash is getting confused because of the overlapping. Is it possible to change the instance name of the target after dropping a generator icon on the target so that the script doesn't get confused? the layer order doesn't seem to have any bearing on anything here as I had hoped.

The file is located (upload tool isn't working) at:
http://www.paraminionstudios.com/dump/PleaseHelp.zip

On "vacation", working for a client. never fun.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 06-02-2004, 05:17 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Drag And Drop, Overlap Problem.
Hi all,

I have been working on the Drag and Drop template that comes with flash and have altered it to have only two places to drop items, a folder, and a trash can. The problem that I am having is when the object is dropped into the folder or trash can it sits on top of it obscuring the image or either the trash or folder.

All I want it to do is disappear or perform some sort of action i.e. play a fade out movie upon locking to the target object.

Can any one help?

Drag And Drop, Overlap Problem.
Hi all,

I have been working on the Drag and Drop template that comes with flash and have altered it to have only two places to drop items, a folder, and a trash can. The problem that I am having is when the object is dropped into the folder or trash can it sits on top of it obscuring the image or either the trash or folder.

All I want it to do is disappear or perform some sort of action i.e. play a fade out movie upon locking to the target object.

Can any one help?

Drag And Drop - Detecting Complete Overlap
Imagine you have a container target area on one side of the stage and a set of draggable movieclips on the other side (outside of the container area). I'm looking for the correct properties to determine if my draggable movieclip is completely over top of the container target area - not overlapping at all. The standard dropTarget only tells me that part of it overlaps, right?

Anyone know of a standard function/property that detects a complete movieclip overlap when dragging? I can't seem to figure out how to read the stage relative x/y coordinates (assuming upper left corner registration) of the object I'm dragging. That would probably solve my problem as I know the stage x/y and width/height coordinates of the stationary container target.

Hope that makes sense. Thanks. I'm new to AS3.

Drag And Drop Targets
The actionscript in this movie I have attached for drag and drop targets I have used before and it has worked. I've added it to this movie and it's not working. When you drag the skeleton onto the brown target I want the red circle above it to change to green. Can anyone see why it's not working please?

Drag And Drop Using Targets In AS2
ok... I've made a tut on drag and drop using targets... but for some reson it only works in AS1... and I can't find the reson why...(!!)

Here's my code:

Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
}

can any one tell me what's wrong?

Drag Drop Targets
I'm trying to move a movie clip so that when it's moved over another movie clip some text is displayed in a dynamic text box.


Code:
on (press) {
startDrag("drag", true);
this._parent.reply_txt.text = "pop";
}

on (release) {
stopDrag();
if (eval(this._droptarget) == this._parent.area) {
this._parent.reply_txt.text = "yes";
} else {
this._parent.reply_txt.text = "no";
}
}
I'm not sure where I'm going wrong. If you move the "backSkirt" movie clip onto the "area" movie clip the text box changes but not correctly.

Any help would great.

Jemes

Drag And Drop In Targets?
hello friends, pls help me out.!!!

i'm doing a drag drop project in flash. in that two movie clips (instance names = book1 and book2) are given. if the first moviclip (book1) is dragged and dropped in the position of second movieclip(book2), automatically the second movieclip(book2) should be dropped in the position of first movieclip.(book1)
again if the first movieclip(book1) is dragged and dropped to the previous position, the second movieclip(book2) should come to its previous position.
(vice versa)

could you please....... help me.....

Drag And Drop Targets
When all the targets have been targeted when you drag and drop objects onto them how do you set an action to play a movie clip?

Drag And Drop Using Targets
Why dosent this code work in falsh mx 2004?

Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
the start dragging part works
and the stop dragging part works
but all the if-part dosen't work...
It works in flask mx, bur I can't figure out what to change to make it work in flash mx 2004

heeeelp

Drag And Drop Using Targets
I have created 6 dragable movie clips using the tutorial I found here. I also have the "drop zone". What i need to try and do with some more code is only allow the 6 movieclips to be dragged onto the dropzone in 1 correct order. If it is correct it disappears, if incorrect it gets placed away from the dropzone. I have no idea where to start with the code, any help would be greatly appreciated.

Thanks

Drag/Drop Need To Know Both Targets
Hi,

Have a look to the attached file here.

1. Imagine all the movies input_# and output_# are created by using AS.
2. There can be n number of input_# and output_# movies on the stage.

When I press on yellow triangle and release it on yellow circle, I need to know when I release, source triangle movie name and yellow circle movie name, on which I am releasing mouse.

I am looking for a general method(class or something). I don't want to bound this behavior on certain movies by writing design time code.

Regards

Drag And Drop Using Targets
Why dosent this code work in falsh mx 2004?

Code:
on (press) {
startDrag("_root.green");
}
on (release) {
stopDrag();
if (_root.green._droptarget == "/computer") {
_root.computer.gotoandStop("green");
}
the start dragging part works
and the stop dragging part works
but all the if-part dosen't work...
It works in flask mx, bur I can't figure out what to change to make it work in flash mx 2004

heeeelp

Loading Drag And Drop With Targets
I have created a drag and drop button with a _droptarget that plays a specified frame inside the _droptarget movie clip.
Works fine when I test it, BUT it does not work when it loads into the main movie

Can anyone help?

Movie Structure
main.swf
nav_level3.swf
story1_level1.swf

Script
on (release) {
stopDrag ();
setProperty ("_parent.product01", _x, "87");
setProperty ("_parent.product01", _y, "100");
if (_parent.product01._droptarget == "/target") {
_parent.target.gotoAndPlay("01");
}
}

Multiple Drag Drop Targets
i'm using this action script to do a drag and drop target set up.


Code:
fscommand("fullscreen", "false");
fscommand("allowscale", "false");
stop();

// don't use the hand icon
drag_mc.useHandCursor = false;

// handle press event
drag_mc.onPress = function() {
this.startDrag(false, 26, 25, 613, 170);
this.onMouseMove = function() {
updateAfterEvent();
};
};

// handle release event
drag_mc.onRelease = drag_mc.onReleaseOutside = function() {
stopDrag();
this.onMouseMove = undefined;
if (this.hitTest(_root.dropTarget_mc)) {
this._x = _root.dropTarget_mc._x+(_root.dropTarget_mc._width/2)-(this._width/2);
this._y = _root.dropTarget_mc._y+(_root.dropTarget_mc._height/2)-(this._height/2);
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
};


how can i make it work with multiple mc's? I appreciate the help.

Drag And Drop Multiple Targets
I have a movie with ten tokens to be dropped onto about 34 items.
I want the get the destination code when the tokens are dropped on the item. (named item1 - item34)

With the code below, the tokens only go back to their original position, but if i substitute the "i" for a 9 ,to test it for example, it works fine. The token stays on item9 and gives me dest1=9 . If i drop it on item4 it goes back to the original position.

how do i get this to work for all 34 items?

on (press) {
startX = this._x;
startY = this._y;
startDrag(this, false, 30, 15, 720, 435);
}
on (release) {
stopDrag();
}
on (release) {
for (i=1; i<=_root.maxitems; i++) {
if (this.hitTest(_root["item"+i])) {
_root.dest1=_root["item"+i].dest;
} else {
this._x = startX;
this._y = startY;
_root.dest1="";
}
}
}

Drag And Drop On Multiple Targets
I have been following this tutorial:
http://www.hed.swin.edu.au/design/tu..._tut/index.php

Everything works out fine. Except I can only define the movie clip to be assigned to one target. I created five separate targets, and five separate drag objects. I would like to be able to drag any of the five objects to any of the five targets. As of now, I don't have a problem assigning the objects to all work on the same target, or have them each assigned to one of the five targets.

Is there a simple way to change the script to allow the objects to drop on any of the five targets?

Here is the script I have:
onMouseMove = function(){
updateAfterEvent();
}

function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this,true,63,85,530,465);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(2);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/3;
this._y -= (this._y-this.myHomeY)/3;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/3;
this._y -= (this._y-this.myFinalY)/3;
}
};
}

//this is where the object is assigned to the target
dragSetup(ruff_mc,target1);
dragSetup(chee_mc,target2);

I've tried everything I can think of from copying the dragSetup like this:
dragSetup(ruff_mc,target1);
dragSetup(ruff_mc,target2);
dragSetup(ruff_mc,target3);
But when I do that, it ignores the first two, and only will go to target3.

Any help would be WONDERFUL!!!!

Drag'n'drop To Multiiple Targets?
hey folks i have been using some tutorials to drag and drop objects to targets..... i have been trying to work out if its possible to move an object to multiple targets. i have tried a few ways like repeating the drag drop locations.... but when i do this nothing seems to be draggable.....hmmmm i think just maybee i'm doing somthing wrong wrong wrong.... i have been using script to tell the object if its not released on target it goes back to its original starting point.......

also does anyone know if its possible to drag an object from within a movie clip (or scroll menu type thing....) i'm guesing this works by creating a duplicate movie somehow.......


regards......

Drag N Drop With Multiple Targets
Hi actionscripters ;)

Does anyone have a good example of drag and drop with multiple targets? I am working on a smart way to code an interface where the objects in the menu can be dropped on a variety of places and then be moved somewhere else if necessary until the user is finished.

Thanks for your time, all replies are very much appreciated ;)

regards
Michael

Drag And Drop Multiple Targets
i am creating a flash project in which there is a drag and drop feature at the moment only one oblect can drop onto one target. i would like all the objects to be able to be dragged onto all the targets.

the project files can be downloaded here: CLICK HERE

if you have any questions just ask!
thanks in advance

Drag And Drop Into Multiple Targets
i am creating a flash project in which there is a drag and drop feature at the moment only one oblect can drop onto one target. i would like all the objects to be able to be dragged onto all the targets.

the project files can be downloaded here: CLICK HERE

if you have any questions just ask!
thanks in advance

Drag And Drop With Targets PROBLEM
I know there are posts on the forums about drag and drop with targets but none of them help me.

I have gone through the tutorials on drag and drop and have successfully made a number of drag and drop flash animations.

HOWEVER.....

I can't get this **** target thing to work and I'm following the tutorial as closely as I can.

Wouls someone please take a look at my FLA / code and try and give me some pointers. I'm getting really fed up of testing the same scene over and over and over and i want to get on with the next one!

thanks!

Randomizing Drag N Drop Targets
I have simple Drag n Drop interactivity in my flash movie. There are draggable objects to be dropped on their targets. If they reach the desired Target they stick to that target. If the object does not reach its target, it snaps back to its original x,y location.

The code is here:


Code:
{
if (this._droptarget == "/something") {
this._x = _root.something._x;
this._y = _root. something._y;
_root. somethingM.gotoAndPlay(1);
}
else{
this._x = 440;
this._y = 320;
}
}
Two things:

How can I randomize the location of the objects, and then essentially capture that location and plug it dynamically into the code above?

And how can I randomize the location of the targets for those objects to be dropped onto?

(And I suppose an additional question would be, so I don't hide any content, how do I do this without overlaying the objects and targets on top of each other?)



Any help is greatly appreciated, thanks.

Drag And Drop With Multiple Targets
Hey all,

I've been scouring the innernets for the solution to this. I'm sure it's there, it's just hiding.

I've made a drag and drop quiz where you have to drag the labels to the right place, otherwise they just go back to where they were. That was easy enough. But now the bosses decided that they want it so you can get it wrong as well, which means multiple targets. My poor little brain cannot handle it!

I've been looking at changing a variable with the target x and y on mouseover, but that just seems to stop the onRelease function. I'm going to be playing with that today, but if anyone can just wave their magic wand and provide some brain-cooling relief, I'd be much obliged.

Thanks!

Drag And Drop With Targets PROBLEM
I know there are posts on the forums about drag and drop with targets but none of them help me.

I have gone through the tutorials on drag and drop and have successfully made a number of drag and drop flash animations.

HOWEVER.....

I can't get this **** target thing to work and I'm following the tutorial as closely as I can.

Wouls someone please take a look at my FLA / code and try and give me some pointers. I'm getting really fed up of testing the same scene over and over and over and i want to get on with the next one!

thanks!

Drag, Drop, Multiple Targets And Duplicate.
Hello,

I have the folowing problem. I want to create something like this: On the scene you have a square lets call it squareMC and also two square holes in whic you can place the squareMC. Now I want the folowing. When the user klicks on squareMC it becomes dragable and it can be placed on either of the two holes. if you place it outside one of the holes it returns to the starting position. But when you place it on one of the holes it stays there and at the starting position will apear a duplicta of SquareMC wich also will be dragable to the two holes.

So I hope you can help me to achieve this because I am really stuck haha. I understand how I can make something dragable and make it drop but I don't know how to drop it to an target and than duplicate it and to make it return to its starting position.

Thank you in advance,

Andre
The netherlands

Multiple Targets For Drag And Drop Object?
I followed this tutorial:
http://www.hed.swin.edu.au/design/tu..._tut/index.php

And everything works out fine, until I added more targets and objects. I have a total of 5 objects and 5 targets. I would like to allow any of the objects to be dropped on any of the 5 targets. Right now, the object is assigned to one target. How do I make it so that it can go on any of the targets?

Here is the code:
onMouseMove = function(){
updateAfterEvent();
}

function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this,true,63,85,530,465);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(2);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/3;
this._y -= (this._y-this.myHomeY)/3;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/3;
this._y -= (this._y-this.myFinalY)/3;
}
};
}

//here are two of the objects each corresponding to their own target.
dragSetup(ruff_mc,target1);
dragSetup(chee_mc,target2);






------------------------------------
I've tried everything I can think of, even copying the dragSetup like this:
dragSetup(ruff_mc,target1);
dragSetup(ruff_mc,target2);
dragSetup(ruff_mc,target3);
dragSetup(ruff_mc,target4);
dragSetup(ruff_mc,target5);

But, in this case, it ignores the previous targets and will only go to target 5.

How do I make the object go to any of the 5 targets?

Any help will be wonderful!

Drag And Drop Movie Clips On Targets
Hi Guys,

I'm trying to get this script working that involves dropping a movie clip onto one of two others.

If you drop it on one (the apple) the dragged movie clip returns to where it started from and (here's where it goes out the door) when you drop it onto the lamb movie clip it's supposed to advance to a new frame - but it doesn't.

Anyone know why?

Mossie


onClipEvent (mouseDown) {
xorigin = _root._xmouse;
yorigin = _root._ymouse;
if (this.hitTest (_root._xmouse, _root._ymouse, true)) {
this.startDrag();
}
}

onClipEvent (mouseUp) {
_root.drop = _droptarget; // sends the address of whatevers under the box to the text box (created as a dynamic text box)
this.stopDrag();

// this code returns the dragged object to the place it started if the object listed - apple, is not the right answer
if (_root.drop == "/apple") {
if (_root._xmouse > _root.apple_X) {
this._x = xorigin;
this._y = yorigin;
}
}else{
this._x = eval (_root.drop)._x; //coverts string stored in droptarget to an object reference
this._y = eval (_root.drop)._y; //coverts string stored in droptarget to an object reference

if (_droptarget = "/apple");
stop;
}
}

Drag & Drop - Multi Targets That Swop?
Is it possible to have two draggables for two targets?
Where drag-A can be dropped on target-A or target-B, but if it does, then drag-B can only be dropped onto the other target (where drag-A is not).
The reason for this is a sequence of 15 draggables and targets for a process that need to be completed in the correct order. The code is fine for that, but the process has some steps that can be done in two ways, hence the choice.
In other words, the user can get a correct answer for the whole process if they decide to make some steps one way or the other.
I'm intermediate level in flash scripting but don't know the simplest way to do this. I've research the flash sites but nothing comes close. Maybe the instance names have to be changed dynamically via if/else? Maybe on drop of drag-A onto target-B asomehow changes the logic.

Drag And Drop With Multiple Targets Problem
Hey this is my first post!!, thanks to everybody for this great forum, your help and knowledge makes Flash not so hard.

Well I'm trying to do some kind of quiz (like the one's included in Flash templates), the basic functionality is drag one item and put it in the correct place (or drop place). I take some code of the kirupa's collision tutorials, but I can't apply that to my particular situation.

The current situation is: i have 3 drag rectangles and 3 drop rectangles, I can drag and drop all the drag rectangles, but just the last one (the third drag rectangle), seems to sense the collision with all the 3 drop rectangles.

My code is:

drag_mc = ["drag0", "drag1", "drag2"];
drop_mc = ["drop0", "drop1", "drop2"];

function init() {
numDrags = drag_mc.length;
for(i=0; i<numDrags; i++) {
var rect1:MovieClip = drag_mc[i];
temp1 = eval(rect1);
temp1.onPress = function() {
this.startDrag();
drop = false;
};
temp1.onRelease = function() {
this.stopDrag();
drop = true;
};
} // fin del for principal
this.onMouseMove = function() {
collision_detect("temp1");
};
};

init();

function collision_detect(rect) {
numDrops = drop_mc.length;
for(j=0; j<numDrops; j++) {
var rect2:MovieClip = drop_mc[j];
temp2 = eval(rect2);
temp1 = eval(rect);

if(temp1.hitTest(temp2)) {
trace("collision");
temp2._alpha = 40;
}
else {
temp2._alpha = 100;
}
updateAfterEvent();
}
}

Thanks in advance

(Flash 8) Drag And Drop Targets/Main Timeline
In all of the drag and drop tutorials I've looked at, when you drag the object to the target, It goes to a keyframe within the target's timeline. Instead, how would I make the playhead switch to a different keyframe in the main timeline? This is the code I am working with (Inserted into the drag-able object):

on (press) {
startDrag (this, true);
}
on (release) {
stopDrag ();
if (this._droptarget == "/target") {
_root.target.gotoAndStop(2);
}
}

The '_root.target.gotoAndStop(2);' part makes it go to frame 2 inside "target" (which is a movie clip), but i'd like it to go to frame two in the main timeline. How would I edit the script to make this happen? Ahaha... the board description said nothing is a stupid question. I hope that holds true. Thanks for any help! (By the way I'm working on a simple flash game, but i'm pretty inexperienced with actionscript)

Drag And Drop Using Targets Only Works In Flash Player 5
Hi!

I have tried the "Dragging and Dropping Using Drop Targets" tutorial. Link: http://www.kirupa.com/developer/actionscript/dragdrop.htm

A simple question, how come this function doesn't work when you publish the file for flash player 8? It only works up to flash player 6...

Are there some way to make it work in flash player 8?

PLEASE HELP Quiz Randomly Misfunctions; Drag And Drop Can't Recognize Targets
Alright, this is a two part question.

First, I created a quiz with multiple choice, fill in the blank, true/false, etc. interactions. Randomly, the quiz will get stuck on a true/false question with the default radio buttons showing rather than "true" "false" and it won't accept a response. This typically happens after one or two other T/F questions have been answered. It happens on different T/F questions every time I test it. Any thoughts?

Next, when I try to load the quiz.swf into another mc in my lesson.swf after the content, the quiz will work fine until it gets to the drag and drop question, where the drag objects will never "drop" onto their targets. It just won't recognize the targets. I'm assuming this a problem with the coding and I need to change the imported quiz's actionscript for the drag/drop interaction from _root to something elses, but I don't know where to find that or what I should change.

I've seen both of these problems on a number of posts but as of yet, I have not found a good solution.

Does anyone have any ideas? Please help!!! =)

Drag And Drop Quiz - Why Do Targets Keep Appearing In Subsequent Quiz Questions?
I'm trying to create an e-learning quiz that will be a series of drag and drop questions (one per page). The user will be asked a question and will have 8 images visible, but only one of them is correct. So, there are 8 drags to one target.

When the user drags an incorrect image to the target, a text image appears that says to try again, and the image will return to its original location. When the correct question is dragged to the target, a button appears that will take them to the next question. Everything was working until I started to create question 2. I created new drag and drop instances for question 2, but it seems that the images from question 1 continue to be visible in the subsequent question(s) when testing my movie. Depending on how many choices I try to drag before I pick the correct answer in question 1, I also find that some of the button states are no longer active in question 2. What I am doing wrong?

I'm new to AS3 and actionscript in general. Part of my code is based on this tutorial: http://www.monkeyflash.com/flash/drag-and-drop-in-as3/.

I'm attaching my .fla file in hopes this will help others who are having the same problem.

[MX] Drag And Drop Multiple Targets Multiple Drags
I have a drag and drop that has six dragable items to six potential targets. Only three of the targets are correct. Any of the six dragable items can hit a correct target. What I am having issues with is let's say after target 1 is hit, I don't want it to be able to get hit again. My code looks like this. But trying to do the enabled false does not work. Any idea how I can disable target 1 below assuming that it was just hit for the first time so it can't be hit again? Thanks.

but1_mc.onRelease = function() {
stopDrag();
if (this.hitTest(target1_mc) || this.hitTest(target2_mc) || this.hitTest(target3_mc)) {
if (this.hitTest(eval("target1_mc"))) {
target1_mc.enabled = false;
}

correct = correct+1;
}

Drag And Drop MC, Involves Polygonal Boundary, Drop Into Trash.
Hello. This is my desperate problem:

I am creating a circuit diagram designer.
There is basically instructions on the left, in a scrolling textbox (taken care of) and above that a rectangle with a bunch of components in it.

You need to be able to drag the circuit part from the side bar (a duplicate, so that the original remains in the same spot), and to a square on the grid on the stage of this program(Should snap to place...). Each clone should be able to be moved. Like so: You Press on a MC to drag it, the thing you are dragging to the stage is of course a clone. You release the mouse button, so it drops on the grid. It snaps into place. *Oops, you made a mistake. You press on it again, it is draged by your mouse to another square, and does not make a clone. *mind Changes... I dont want to use this one any more. You press on the MC, drag it to a bin which animates to show you the MC is being dragged over it. You release, the MC in question is deleted/removed...

You need to be able to rotate circuit parts by clicking on it so that it highlights, then pressing space bar.

It must also be possible to delete a duplicate by dragging it to the trash (an image/ MC), and last but not least, it is required to save the contents of the stage, or print them off.

Please note that to print it off, there are 2 input boxes outside the stage. One for the title, and one for the Users' Name. When they click on the print button, the two dynamic text fields must retrieve the values from the box outside of the programs' stage.

One Last detail: The cloned objects to be dragged around net to be in a six co-ordinate polygonal boundary, so that no-one can place any objects outside of the stage.

If anyone can help me, i would greatly appriciate it. I need to get this done asap. The graphics have been taken care of, it is just the coding to be done now. HELP, HELP PLEASE!




Thanks - Matt K

Drag&Drop Duplicate Movie With Drop Target
Hi There...

I'm creating a game where people can design their own cell phone by adding diamonds to it, a "Bling Phone" if you will. You will be able to add 4 types of diamonds to it, change the phones skin, add music to it, give it a name etc etc

I've got it to a stage where it when you click on a diamond(mc) on the stage it duplicates a hidden diamond(mc with a button inside) off stage and you can drag it around etc and then click save. Theres a script which grabs the instance name, x and y position of every diamond on the stage and stores it into a multi dimensional array which will be fed into a mysql database for retreival purposes at a later date.

Now my problem is i would like to be able to use the phone(mc) as a drop target but i'm not sure where to put the droptarget script. does it go on the original MC diamond or the duplicated mc diamond with the button inside it ?

Once a diamond has been dropped onto the phone i would also like it if the user then drags the diamond off the phone it gets deleted. I think i've got it half working but my variables which keep track how many diamonds are on stage dont appear to be updating.

I've attached the .fla file to this post if some is interested in taking a look and helping me out. The droptarget script is only on the blue diamond so far.

Any help would be much appreciated.

Thanks

Rob

Drag And Drop - Multiple MC's On To A Single Drop Target
Hi All

I am struggling with a drag and drop excercise.

I have 15 movie clips that need to be dragged over a single drop target in a specific order. i.e 1,2,3,4, when the correct movie clip is dragged to the drop target a movie within the drop target needs to advance a single frame to display the result of the correct movie clip being dragged over the drop target.

Would I be correct in thinking I need to use some kind of array to compare the clip that is being dragged to the frame position of the drop target?

I have the bones of this working and need advice / help on getting the clips to work in the specific order required. I can post my code if needed.

Thanks in advance.

btw - am using Flash MX 2004 Professional

Drag Abd Drop, Rollover When Drag Is Over Drop Target?
Hi, im using Flash MX 2004.

I am building a drag and drop, and I have a MC that can be dragged around the stage. The trouble im having is trying to make the drop location do something when i drag the MC over/off it.

I have the following code which works.

objectToDrag.onMouseMove = function() {
if ((objectToDrag.hitTest(dropper)) && (component._beingDragged == true)) {
dropper._alpha = 50;
temp++;
trace("working"+temp);
}
}

This will make the clip i am dragging the draggable MC over change alpha, but for the life of me I cant figure out how to get the alpha to change BACK, after the draggable MC is taken away from the 'dropper'.

Is there a better way that hitTest??

Cheerz,
Dwayne

[fmx] Drag And Drop With Multiple Drop Locations
Hi

I am trying to make a draggable object have two drop locations, but it will still only drop to one. Please if anyone can help me or notice my mistake it would be really appreciated.


on (release) {
if (_root.DragMotor._droptarget == "/Socket2") {
_root.DragMotor._x = _root.Socket1._x;
_root.DragMotor._y = _root.Socket1._y;
_root.CheckMotorDrop();
} else {
_root.MotorDropped = 0;
}
if (_root.DragMotor._droptarget == "/Socket1") {
_root.DragMotor._x = _root.Socket2._x;
_root.DragMotor._y = _root.Socket2._y;
_root.CheckMotorDrop();
} else {
_root.MotorDropped = 0;
}

function CheckMotorDrop () {
//set the speech bubble to give information
_root.txtSpeech = "You have added a motor to the circuit.";
setProperty(_root.DragMotor, _width, 55);
setProperty(_root.DragMotor, _height, 55);
_root.MotorPowered = 1;
_root.DragMotor.play();
_root.MotorDropped = 1;
}


Thanks for your time, Matt.

Drag And Drop With Additional Drop Area
Hi there i have a little project on at the moment, an educational game for children, where items need to be dragged from one position to another, but with the possibility of being dragged to a seperate holding area first, before being dragged to their final resting area.

i have this code which deals with a straight 'a to b' drag and drop function:


Code:
setProperty(_root.boing,_visible,false);
function dragSetup(clip, targ) {
clip.onPress = function() {
startDrag(this);
this.beingDragged=true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged=false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
_root.targ.gotoAndStop(2);
} else {
this.onTarget = false;
_root.targ.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
setProperty(_root.boing,_visible,true);
}
};
}

dragSetup(circle_mc,targetCircle);
dragSetup(circle2_mc,targetCircle2);
dragSetup(circle3_mc,targetCircle3);


which i have then tried to adapt to 'a to b possibly via c':


Code:
function dragSetup(clip, targ, drop) {
clip.onPress = function() {
startDrag(this);
this.beingDragged = true;
};
clip.onRelease = clip.onReleaseOutside=function () {
stopDrag();
this.beingDragged = false;
if (eval(this._droptarget) == targ) {
this.onTarget = true;
this.onDrop = false;
_root.targ.gotoAndStop(2);
} else if (eval(this._droptarget) == drop) {
this.onDrop = true;
this.onTarget = false;
_root.targ.gotoAndStop(1);
} else {
this.onTarget = false;
this.onDrop = false;
_root.targ.gotoAndStop(1);
}
};
//the variables below will store the clips starting position
clip.myHomeX = clip._x;
clip.myHomeY = clip._y;
//the variables below will store the clips end position
clip.myFinalX = targ._x;
clip.myFinalY = targ._y;
//the variables below will store the clips end position
clip.myDropX = drop._x;
clip.myDropY = drop._y;
clip.onEnterFrame = function() {
//all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged)
// then move the MC back to its original starting point (with a smooth motion)"
if (!this.beingDragged && !this.onTarget && !this.onTarget) {
this._x -= (this._x-this.myHomeX)/5;
this._y -= (this._y-this.myHomeY)/5;
trace("didn't drag anywhere");
//if the circle is dropped on any part of the target it slides to the center of the target
} else if (!this.beingDragged && !this.onDrop && this.onTarget) {
this._x -= (this._x-this.myFinalX)/5;
this._y -= (this._y-this.myFinalY)/5;
trace("correct!");
} else if (!this.beingDragged && !this.onTarget && this.onDrop) {
this._x -= (this._x-this.myDropX)/5;
this._y -= (this._y-this.myDropY)/5;
trace("teacher drop area");
}
};
}
dragSetup(circle_mc, targetCircle, dropPlace);
dragSetup(circle2_mc, targetCircle2, dropPlace);
dragSetup(circle3_mc, targetCircle3, dropPlace);


any ideas where i'm going wrong? it looks right to me but only ever seems to work when you drag 'a to b'

thanks,
dave.

Drop-down Menus That Overlap
My current problem is trying to create submenus that exist in the same space. Well, basically what I'm trying to do is rip off the main menu on www.macromedia.com, but it isn't working so well yet.

First, I have a menu that uses a hitscan=nextFrame/prevFrame setup to animate the buttons. You know, if you move in the hitscan area, the submenu appears. If you move the mouse off, the submenu disappears.

Creating multiple instances of movie clips that occupy the same space obviously don't work. I thought moving the submenu off of the first frame of each button would remove it from the hitscan area, but no. Moving all the buttons onto separate keyframes in the main timeline is pretty cumbersome, and near-impossible to manage...

Is there a vital command I'm missing? (You know, every time I ask that question, chances are that I am.)

Need Drop Down Menu To Overlap
Hi,

Does anyone know how to create a drop down menu bar that will overlap the html page beneath it without creating a duplicate of the html site in the flash file?

Thanks

Drop Down Menu That Overlap Frames
hi,

i'm having a problem with drop down menu 'cos i'm using frames.

my drop down menu got cut off by the frame that contains the main content. is there a drop down menu whereby it can overlap the other frame?

thanks.

Lawrence How

Drag And Drop : Drop Options
I have some simple drag and drop code here that works fine. But it is set to let each object go to only one "dropZone". I would like be able to have each object be able to go to any of the drop zoned named "dropZone1, dropZone2, dropZone3....". I wouls also like to have is so you can't put multiple object in one zone. Basically, if the zone is being used, the object will again revert back to it's original place. Actionscript is preety new to me so I have trouble with format. I have tried a bunch of stuff that seems like it would work, but I get wierd results. any help would be much appreciated, thanks.

onClipEvent (load) {
this.origX = this._x;
this.origY = this._y;
}

onClipEvent (mouseDown) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.stopDrag();

// see if the dropZone conatins the center of this mc
if (_parent.dropZone1.hitTest(this._x,this._y,true)) {

// center it on the drop zone
this._x = _parent.dropZone1._x;
this._y = _parent.dropZone1._y;

} else {

// return it to its original location
this._x = this.origX;
this._y = this.origY;
}
}
}

Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!

I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!

basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!

the code i'm using is below


Code:


var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {

// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}

// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);

}

}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!

Drag And Drop To Any Drop Target
Hi guys....I am trying to create some more generic code for a project im on....infact you guys have already helped me lots in getting it up and running!

I have basicly got it where all the dragObjects and assigned functions within a for loop and therefore been assigned to their own dropTargets...all working fine, however a situation is needed where if a user drops a clip onto anything rather than a hit area it doesnt just register as an incorrect drop.....at the moment a drag that misses a dropTarget will be the same as one that is dropped onto an incorrect drop target and thats just a bit unfair for them as it means they have used up one of only two chances!!!

basicly I need to know if its possible to obtain using the coding style that i already have been whether a drop is onto any of the drop targets before than going to chec if its the correct one or not....sorry for the long winded talk but seemed the only way i could explain!!!

the code i'm using is below


Code:


var Xpos:Number;
var Ypos:Number;
var objects:Number = 2;
for (i = 1; i <= objects; i++) {

// assigning the on press events to the dragObjects
this["dragObject"+i+"_mc"].onPress = function() {
this.startDrag(true);
// assigning the original X and Y of the dragged clips
Xpos = this._x;
Ypos = this._y;
}

// assinging the on release events to the dragObjects
this["dragObject"+i+"_mc"].onRelease = function() {
// finding the number of the dragObject to use in the submitAnswer function
objName = this._name
dragNumber = Number(objName.substr(10, 1));
submitAnswer(dragNumber);

}

}
// function to assertain whether the drop was a successful one - whether dropObecjt1 was dragged on dropTarget1 and so on
// the number is passed from the onRealease function
function submitAnswer(dragNumber:Number) {
this.stopDrag();
// if its dropped onto its correct target then turn the button off, place ontop of its target
if (this["dragObject"+dragNumber+"_mc"].hitTest(this["dragTarget"+dragNumber+"_mc"])) {
this["dragObject"+dragNumber+"_mc"].enabled = false;
this["dragObject"+dragNumber+"_mc"]._x = this["dragTarget"+dragNumber+"_mc"]._x+50;
this["dragObject"+dragNumber+"_mc"]._y = this["dragTarget"+dragNumber+"_mc"]._y+50;
trace ("knob jockey");
} else {
// if it is dropped onto a wrong target then chuck it back to where it started!
this["dragObject"+dragNumber+"_mc"]._x = Xpos;
this["dragObject"+dragNumber+"_mc"]._y = Ypos;
}
}
thanks for any help!!

Drop Targets
I'm creating a sorting activity and i do not want to give the user the sorting rule. For example if they need to sort blue buttons and black buttons, i do not want to label the targets as blue or black. I want the user to decide on the sort themselves and then check to see if their sort was correct. Is there code that I could use to check the target area for all like items?

ActionScript 2, flash 8

Thanks in advance

Drop Targets
I'm creating a sorting activity and i do not want to give the user the sorting rule. For example if they need to sort blue buttons and black buttons, i do not want to label the targets as blue or black. I want the user to decide on the sort themselves and then check to see if their sort was correct. Is there code that I could use to check the target area for all like items?

Thanks in advance

Two Drop Targets At Once?
I'm using this actionscript at the moment:


ActionScript Code:
if (_root.pin2._droptarget == "/container/mcDraw"){


but is it possible to have two droptargets so that the actions are only carried out when the drag object is dropped within the bounds of two different movieclips? i.e when all three are overlapping.

Copyright © 2005-08 www.BigResource.com, All rights reserved