ActionScript 3.0 :: Drag And Drop - Single Object Multiple Targets

Apr 6, 2011

I'm doing a project where I have a movieClip grey1_mc and I have 2 white boxes, which are also movieClips white1_mc and white2_mc. What I want to do is to add a Drag and Drop functionality such that, grey1_mc can lock onto white1_mc if droped on white1_mc, also grey1_mc can can lock onto white2_mc, if dropped on white2_mc. And the usual snapping back to original position if placed elsewhere on the stage.

This is just for one movieClip grey1_mc. I've got 4 such movieClips
[grey1_mc, grey2_mc, grey3_mc, grey4_mc,] and 8 targets
[white1_mc, white2_mc, white3_mc, white4_mc, white5_mc, white6_mc, white7_mc, white8_mc,] ,....
So, grey1_mc can hit white1_mc or white2_mc.
grey2_mc can hit white3_mc or white4_mc.
grey3_mc can hit white1_mc or white2_mc.
grey4_mc can hit white3_mc or white4_mc.
MovieClips white5_mc to movieClip8_mc are only to show a error message in the o/p window.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Drag And Drop Single Object Multiple Targets?

Mar 16, 2011

I've been trying to do a drag and drop game, the logic of the game is that I have 4 blocks grey1_mc, .

grey4_mc, and 8 targets target1_mc,target8_mc.Now, grey1_mc can be dropped only on targetgrey1_mc and targetgrey2_mc, similarly grey2_mc on targetgrey5_mc and targetgrey6_mc grey3_mc on targetgrey1_mc and targetgrey2_mc grey4_mc on targetgrey5_mc and targetgrey6_mc

when grey1_mc or any other greyBlock hits it assigned target it should be locked onto the target and should not be clickable. Also it should play a movieclip inside of it i.e., a Green Tick Mark. if grey1_mc hits any other target it should lock on to that target play a " Red Wrong Movie" and then snap back to its original position.

similar functionality is going to be used for the rest of the grey movieclips.the code that i've written is this...

var originalX:Number;
var originalY:Number;
var greyBox:Array = [grey1_mc, grey2_mc, grey3_mc, grey4_mc];

[code]...

View 0 Replies

ActionScript 3.0 :: Drag And Drop To Multiple Targets?

Oct 5, 2011

I have created a simple drag and drop game with 4 signs to be dragged onto 4 targets. As two of the answers are the same I need to be able to have the possibility of both signs to be dragged onto either target.

Quote:

stop();
// Second Level Quit button
// loads second.swf in again
quit_mc.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_2);

[Code]....

View 1 Replies

Professional :: Drag And Drop To Multiple Targets?

May 11, 2010

Im trying to create a simple drag and drop app where you can drap a movieclip into multiple areas.This is the code i have so far (taken from a tutorial i found) thats works perfectly for 1 target but not for multiples. I initially tried giving the targets the same instance name but that didnt work.
 
stop();var startX:Number;var startY:Number;
square_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);square_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void { square_mc.gotoAndStop (2); event.target.startDrag(true);

[code]....

View 6 Replies

ActionScript 3.0 :: Drag And Drop With Multiple Targets

Sep 17, 2010

I'm having a problem find a solution to my drag and drop problem. Here is what this flash piece is basically supposed to do: 9 dragable items on the stage5 targets, numbers 1 - 5, where the items can be placed5 of the 9 dragable items are the correct answer and the user needs to drag them to the correct target, and have to be in order from 1-5. (eg. let's say the instructions are: Please place the, in the correct order, the 5 steps to getting ready in the morning.
Drag items Targets
Brush teeth 1.
Change oil in car  2.
Wash Face 3.
Put pants on 4.
Shower 5.
Get out of bed
Do tax's

So far I have it so if you drop the correct answer into its correct target it snaps to it and disable it's eventListeners. If you drop the drag item on the other targets they snap to it and disable it as well. They only problem is if the user accidentally drops the item anywheres else on the stage it locks it in place. Instead I want it to return to the original x and y position.

Here is my code
DragDrop.as
package{ import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
public class DragDrop extends MovieClip {
public var _targetPiece:*;
public function DragDrop() {
[Code] .....

View 5 Replies

ActionScript 2.0 :: Drag And Drop Multiple Targets?

Sep 9, 2011

I'm using the script "drag & drop multiple targets", with the swapDepth enabled, making the last clicked item to come in front of all the clips on the board.So far, so good. But I have some of the draggers made up by small circles, stacked/glued together vertically (7 in a row) which make these new draggers taller than the majority. The problem is that when I try to drag and snap them, the bottom circle doesn't center into the middle of the dropping zone like the others. These new draggers center themselves with their vertical center into the center of the dragging zones.

I really need to have all these taller draggers centered themselves with the bottom cercle into the middle of the dropping targets, like the simple draggers made up by a single circle.Is there a way to work around, applying a rule to the chosen individual objects without specifically applying to the main script? I mean when you drop the item, forcing it to snap a little bit higher in relation with Y coordinate of the dropping zones.

ActionScript Code:
function dragSetup(clip, targArray) {
clip.onPress = function() {
startDrag(this); this.swapDepths(_root.getNextHighestDepth());

[code]....

View 1 Replies

ActionScript 2.0 :: Drag And Drop With Multiple Targets?

Aug 1, 2007

I've made a drag and drop quiz where you have to drag the labels to the right placeotherwise 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.

View 1 Replies

Professional :: Drag And Drop Objects To Multiple Targets?

Nov 27, 2010

i have tried a lot of time to make my project into a success.this is the link to my swf...all objects are accepted when i drop it into the plastic bin

var startX:Number;
var startY:Number;
var counter:Number = 0;

[code]....

View 3 Replies

ActionScript 3.0 :: Drag And Drop Objects To Multiple Targets

Nov 27, 2010

i have tried a lot of time to make my project into a success.this is the link to my swf... all objects are accepted when i drop it into the plastic bin.URL..

View 1 Replies

ActionScript 1/2 :: Multiple Drag And Drop, Multiple Targets?

Mar 25, 2012

I'm making a Multiple Drag and Drop in Multiple Targets educational puzzle for 6-7 y/o kids that tries to teach them a bit about which plants grow in which environments in the country. So, I have a map of Mexico divided in 3 diferent zones: desert, forest and tropic, and 6 different plants (of 3 different groups: cacti, pines and tropical flowers, 2 of each) scattered across the stage and around the map. The goal is for the kids to drop the plants in the right zone and then to click a "verify" button that triggers a validation process. Each of the plant's movie clip has 2 frames with a stop(); action on each: the plant graphic spans across both frames and the second frame has a red error sign over the graphic that indicates an error has occured (if that's the case). Then the validation process triggered by the "verify" button is supposed to move the playhead of each wrongly placed plant move clip to the second frame to show which plants are misplaced and move the main timeline's playhead to a frame that contains a "Please try again" text and a "Restart Puzzle" button. If all the answers are right, an animation plays saying that it was VERY WELL DONE! .
 
I searched the internet for some tutorials and found a file that is pretty close to what I need. I've tried to adapt the code to my puzzle but have failed miserably. The file is here if you want to check it out (scroll to the bottom of the page, it's called Soldier.fla). I'm not pasting the code here because it's VERY long, but I will if required. If you want me to upload the files somewhere else and link them here, I will. If you need me to send them to you I'll be glad.

View 10 Replies

ActionScript 2.0 :: Drag And Drop To Multiple Targets And Duplicate Movieclip

Dec 8, 2009

I have a full page calendar that uses a duplicate movieclip to add the day squares (actionscript adds the day number)

I want to add a target to that "day" movieclip. (I can do this)

Now the part i don't know how to code:

I want to add a star at the top that can be dragged to the target "day". BUT... On any of the days and multiple days.

So i guess the star needs to duplicate movieclip and be able to drag and drop to any of the targets. The target is on a duplicate movieclip itself so the instance name will need to be the same on all days (or i could have it append 1,2.3 ect to the end of the instance name like: target_mc1, target_mc2...)

View 1 Replies

ActionScript 2.0 :: Altering Code So One Object Can Drag To Multiple Targets

Jun 6, 2011

how I could create a simple drag and drop. So far I am able to get one drag_mc to go to one target_mc. Howver I would like to know how I could change the code so that drag_mc could have multiple targets?

[Code]...

View 0 Replies

ActionScript 3.0 :: Drag And Drop - Multiple Objects On Single Target?

May 16, 2011

I want to create an interactive learning module that would use a simple drag and drop test. I've already browsed the net for guides and it led me to monkeyflash.com that gave me a very helpful guide. On the guide, there can only be one object be dragged to a target. But then, I wanted my test to have multiple objects (movie clips) be dropped on a single target (also a movie clip) only and stick to it. I'm thinking that I could place my draggable objects on an array, but I really had difficulty on executing this.
 
On the code below, a drag object can only be placed on one target only (i.e dragIn1 can only be dropped on targetdragIn1 but not on targetdragIn2). Yet, I want all dragAt objects be dragged on all targetAt, dragIn with targetIn, and dragOn with targetOn.

[Code]...

View 2 Replies

Actionscript 3 :: Drag And Drop To One Single Object?

Mar 3, 2011

I am working on simple flash game in which there r 8 small circles out side of one big circle. i want to drag this 8 small circle one by one to the big circle.Basically 1 plate with their food items.Draging their food items to he plate. i hope this would give you a better idea.I have goggled it the same thing but could not get what i want,

View 1 Replies

IDE :: Drag And Drop With Targets?

Apr 9, 2009

I followed kirupa's drag and drop with targets tutorial. I want the clock in my fla file to get bigger when it touches the bar. How can i do this?

View 7 Replies

ActionScript 3.0 :: Drag And Drop Onto Targets?

Jul 3, 2009

I was wondering if anyone could help with a problem i'm having with flash. I have been given a flash file to edit - creating a drag and drop feature. I've 10 move clips that have to be draged onto the right target. I've given instance names to both the targets and movie clips that have to be dragged. I've used flash for quite a while now, about 4yrs but still get muddled up with actionscript. I've added the following code to one of the movie clips to be dragged and the error below is displayed - The class or interface 'MouseEvent' could not be loaded function drag(event:MouseEvent):void{

[Code]...

View 1 Replies

ActionScript 2.0 :: Drag And Drop To Targets?

Oct 21, 2009

I am presently working on a project that has a map of a country and it needs to be assembled (like in a puzzle game). And an action(like an appreciation) has to appear when the correct piece is placed in correct slot/target....if the wrong piece is placed--the piece has to move to the Previous position.

View 1 Replies

ActionScript 2.0 :: Drag And Drop Targets?

Aug 4, 2003

here is the code i have,

on (press) {
startDrag (this, true);
}

[code]......

View 4 Replies

ActionScript 2.0 :: Randomizing Drag And Drop Targets?

Apr 5, 2006

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;

[code]....

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?)

View 2 Replies

ActionScript 3.0 :: Flash Drag And Drop To Any Of Targets?

Jan 15, 2012

I've created a quick drag and drop game using an old tutorial I found, it requires the user to place the correct object on the correct target area. E.g. star shape needs to be placed in the star shaped hole. I want to change the game so that the user can place the draggable objects on to any of the targets, here is the current code I am working with:

var startX:Number;
var startY:Number;
var counter:Number = 0;

[code]...

View 1 Replies

ActionScript 3.0 :: Drag And Drop Game - Objects And Targets?

Jan 27, 2011

I am designing a simple classify drag and drop game, but I got several objects and targets, for example square shape object can only go to square shape target, however when I have 2 or more square, then the square2 and square3 can not go to square target!

Code:
var objectoriginalX:Number;
var objectoriginalY:Number;
var counter:Number = 0;
triangle_mc.buttonMode = true;
triangle_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject);
[Code] .....

View 3 Replies

ActionScript 2.0 :: Adding Response To Drag And Drop When All Targets Hit?

Jun 30, 2011

I have the following code for a drag and drop game and I need to add a response when all the clips have been placed on the targets.

Code:
//Set onTarget boolean
clipMc.onTarget = false;
clipMc.onPress = function():Void {
//Stop tweens

[code]....

View 0 Replies

Actionscript 3 :: Flex - Multiple Object Drag And Drop?

Aug 12, 2010

Is there a way to implement something like icons on a desktop? Is there an easy way in Flex to implement a selection box and multiple drag and drop?

View 1 Replies

ActionScript 3.0 :: Drop Mc On Multiple Targets?

Mar 18, 2010

I want to create a drag and drop app that will allow the user to drop mc onto either one of two correct targets.I gave the targets the same instance name but that doesn't work.The program only recognizes the first target mc created as correct.How can I make either target the correct one?

function dropIt(event:MouseEvent):void [code]....

View 8 Replies

ActionScript 3.0 :: Drag Drop And Click Events On A Single Movieclip?

Jun 11, 2010

I have one movieclip inside which I created few movieclips...I applied drag drop functionality to main movieclip with which all movieclips inside of it also get dragged along with it..and I want inside movieclips to act as buttons meaning on clicking perticular movieclip it should perform perticular event assigned to it... How to make movieclips into buttons and the main movieclip containing these buttons with drag drop functionality?

View 2 Replies

ActionScript 1/2 :: Drag And Drop Multiple Boxes And Snap To Multiple Locations Then Reveal Button

May 3, 2011

I'm Trying to develop a small game where the user chooses from a range of boxes of the left of screen and can drag 3 of them separatley to 3 holding boxes on ther right. each box can be dragged to any location and the order is not important. Once the 3 holding boxes are all full I want a new button to appear. I completed a tutorial and I've got one box working perfectly but no matter what i try I can't get it working with multiple boxes and locations. Below is a list of the instance names of the movie clips plus my actionscript. I've attached a link to the flash file.
 
[URL]
  
INSTANCE NAMES
 
box 1 = "circle_mc"
box 2 = "circle_mc2"
both the grey boxes are called = "targetCircle"

[Code].....

View 6 Replies

ActionScript 3.0 :: Drag And Drop Multiple Objects To Multiple Target?

Sep 10, 2009

im creating a small drag and drop game in AS3-
 
I have 4 objects and 4 targets,
 
I want to be able to drag any of the 4 objects onto any of the targets, right now all I can manage is to allow each object drop onto one specific target only.
 
I thought by calling all my target names by the same instance name eg target_mc that would work but only one target will ever work.

View 8 Replies

ActionScript 3.0 :: AddChild() - Drag And Drop An Object The Object Jumps Off Some Distance

Aug 25, 2009

I am developing a drag and drop functionality and take a JPEG screen shot of droped objects. my problem is. when i drag and drop an object the object jumps off some distance.. i am unable to clear tat.. Below is my application.as file

[Code]...

View 4 Replies

ActionScript 2.0 :: Drag And Drop Multiple Mc`s

Jan 31, 2011

I want to make an animation like this: when i drag "mc1" in the same time drag "mc2" what is the code for this?

View 3 Replies

Professional :: Drag And Drop Multiple Times?

Aug 12, 2010

Is there a way to make an item, which can be draged onto the stage mulitple times? Like in making beats in music apps. You select a sample and drag it into the stage.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved