ActionScript 3.0 :: Drag And Drop Then SNAP BACK TO ORIGIN?
Mar 10, 2011
5 text choices (choice_1 → choice_5)5 text field targets (box_1 → box_5)FUNCTION:1. Drag the choices to the targets.2. When dropped they display in target fields.3. Then snap back.I thought I had it but no cigar ... must be close though.Everything functions properly EXCEPT when I drag a choice and drop it all five choices go to choice_5 (XY) instead of their own origin.HOW DO I SOLVE THIS?PROBLEM CAN BE SEEN HERE
Code:
import flash.net.URLVariables;
import flash.net.URLRequest;
[code].....
View 2 Replies
Similar Posts:
Sep 7, 2011
i cannot snap the object into its origin. I've made two AS for this one, a DragDrop as and a DragGame as.[code]I just don't know where to put the code that could make the objects snap to its origin.
View 5 Replies
Jun 24, 2010
I have a relatively simple drag and drop function. When the target is hit, the shape stays on it. Otherwise, it goes back to its original place.
ActionScript Code:
square_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
square_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function pickUp(event:MouseEvent):void {
event.target.startDrag(true);
event.target.parent.addChild(event.target);
[Code] .....
The slide function is supposed to bring the shape back to its origin (passx and passy are the coordinates), through an Enterframe event. It works fine, but it only works once. And if I drop the shape, if I pick it up again, it's impossible to "cancel" this action (which means the shape keeps going back to the origin). I tried removeEventListener but no luck.
View 5 Replies
May 20, 2011
Im trying to do a drag and drop system where the user can drag a movie clip into an area. Although i would like to make it snap to a target instead of just sitting wherever it lands in the area. Problem Two:
The next thing i am trying to do is when the user has a movie clip on a target already, and trys to put another movie clip in that target area, it will replace the one thats in there and go back to its current position. Here is the script of what i have done so far:
[Code]...
View 14 Replies
Apr 13, 2011
so i want to have an object be dragable to 2 certain places and only those places.
[Code].....
now this script lets me drag it to one place but not back again.
View 0 Replies
Jul 27, 2010
I'm new to Flash (sort of - I used it a bit back in 1999-2000, but it's changed a LOT since then). I'm making an educational game for my company that involves dragging labels from a word-bank to their correct position on a diagram. I want the kids to be able to drag any one of the five labels and move them to any one of five marked positions on the diagram. I'm using Flash CS5 with Actionscript 3. I used code snippets, so that each individual label has the following code associated with it:
movieClip_1.addEventListener(MouseEvent.MOUSE_DOWN , fl_ClickToDrag);
function fl_ClickToDrag(event:MouseEvent):void
{[code]..
View 3 Replies
Apr 22, 2004
I have a button inside a MC, and I'm trying to get it so if you pull it out a certain distance, it eases a menu out, but if it's not out far enough it eases back in, the same, but in reverse when trying to close the menu...the code I have seems to work, but it opens when you click it first, without dragging it past the point where it has to be to fully open.. the code it this:
Code:
_root.dragMenu.dragBut.onPress = function() {
startDrag(this._parent, false, 645, 370, 720, 370);
};
[Code].....
View 9 Replies
Mar 30, 2011
Ok, first of all I'm new to all of this as I'm just doing some parttime work. I'm trying to make a drag and drop game where the images (imported and made into movie clips with instance names "peg1 - peg7") are to be dragged onto targets (images, made into movie clips with instance names "targetpeg1-targetpet7").[code]
View 3 Replies
Dec 8, 2006
I'm new around these parts (I literally signed up about 3 minutes ago!). I'm a high school student who just started using Flash about a month or two ago, so I'm far from advanced, though I have tackled some of the basics. In class I'm working on an art portfolio site but in my spare time I'm making a virtual dress-up doll (you know, the kind where you can pick up the clothes and drop them on the figure to mix and match outfits).Learning how to make drag-and-drop objects was very easy and there are lots of tutorials on it but what I can't figure out is how to get objects to "snap" into place. I want it so that the doll's hairdo's snap into position because they look kind of stupid when placed incorrectly.
View 7 Replies
Nov 4, 2003
I am using a drag n drop (snap into place) routine. MC1 is dragged onto mc2. I want a button on mc2 to make mc1 go to its original position and reset itself. As it is mc1 goes to frame 2 where the frame is empty.
View 1 Replies
Dec 30, 2005
The app allows the user to drag images from a libray onto a grid and position the elements within the grid. The user can also drag textfields which can be edited and resized.The grid needs to have some sort of snap-to, to make it easier for the user to line up the elements. And then I need to create resize handles around both the editable text fields and the other mc's. Has anyone seen a tutorial or can anyone help me with?
1. Drag and drop with a snap to grid
2. Resize handles for mc's, and inparticular textfields
In the end, I need to be able to track all of the x and y's of the elements on stage and then be able to rebuild their layout when it is loaded in a subsequent session. I'm sure this is going to be difficult.
View 4 Replies
Jan 12, 2012
I have been trying to emulate a drag n drop program from flash and math site dragdroptour snap to location tutorial.It uses a placed variable set at the beginning of the script and updates it with a function used elsewhere. For some reason my version of the code will not update this variable could someone tell me where I've gone wrong? I've done this before in AS and think I used globalvars but I know you cannot do this in AS3 and I'm trying not to go down that route as I know it's bad practise.Its the paper1,2,3 vars that won't update with the release to drop functions.[code]
View 5 Replies
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
Jul 5, 2010
What I am trying to do is make an animated bounce back for a drag and drop game, so if the object is dropped in a location that doesn't satisfy the hitTest it bounces back to a pre set location. It seams simple but there is obviously something not working. Just so people know I am a total newby when it comes to coding in actionscript, so please be gentle as I probably won't understand what your talking about.
Anyway here is the code for the movie click which is being dragged.
[Code]...
View 6 Replies
Feb 4, 2005
drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.
and the clipdrag movieclip is droped at say _x=200, _y=300. Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.
View 4 Replies
Feb 4, 2005
do a drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.
and the clipdrag movieclip is droped at say _x=200, _y=300. Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.
View 4 Replies
Apr 14, 2010
Flash Media Interactive Server 3.5We currently have an Edge/Origin configuration. We have another Origin Server to be used for fail-over. How do you setup a back-up Origin Server?
View 4 Replies
Oct 14, 2008
I tried to create simple animation from this Kirupa's tutorial My aim is to make a circle run from left to right and when it is almost to the edge it will move back to the origin point and it will loop only 3 times. So I came up with totally baby script like this:
[Code]...
But the MC is not move back to the original place. Sorry for not even finish the script for stop looping. Only tweak on play loop it make me very confused. My knowledge is quite in entry level but I eager to learn. Could you let me know what is wrong with the script?
View 5 Replies
Oct 21, 2007
Have a look here: [URL].. those are 5 MCs attached to a container MC. Mouse over and out for a bit and you'll see the problem. If you roll over a square and then out before it completes the tween, and then over again the alpha will fade to 20% as it should but then pop back to the initial value of 100%.
Does anyone understand why this is happening? Has anyone come up with a solution?
[Code]...
If you mouse "through" one of the squares and then wait 5 seconds (the duration of the out tween) and then mouse over the same square it will not pop back to 100%. If you however mouseover quicker it will pop. This leads me to believe there is some sort of timer running even though the tween is not.
View 4 Replies
Nov 17, 2004
I made it so when the user clicks on a link the menu moves to a new location...that works fine. If I make it so the user can also drag it, the whole thing gets messed up because the menu is always trying to snap back to the location.
View 2 Replies
Apr 27, 2011
Anybody know how to drag a tile clip and snap to its adjacent clips in a game like this
View 1 Replies
Sep 26, 2010
I want to make a magic 8 ball in actionscript 3. I'd like to be able to click on the movie clip of the 8 ball, shake it with the mouse, and then have it snap back to its original position when I let go of the mouse button. I have three problems:
1) I can make the 8 ball track the mouse, that's easy, but how do I make it snap back to the original position when I let go of the mouse button?
2) I want to constrain the movement of the 8 ball movie clip so it won't go all over the stage, just enough to move it back and forth a bit.
3) How do I randomize output of answers in the 8 ball window...such as, "not now," "doesn't look good," or "yes" etc?
View 2 Replies
Apr 14, 2011
I'm having trouble with Matrix Transforms in Flex.
I have a Flex Canvas with nothing but an Image in it, like so.
<mx:Canvas>
<mx:Image id="img" source="/some/Url" />
</mx:Canvas>
[Code].....
View 5 Replies
May 20, 2009
Basically I was instructed to put this code into my main timeline:
function completedPuzzleCheck(){ // add this to your main timeline
if(!numCompleted){
numCompleted=1;
} else {
numCompleted++;
[Code] .....
It all works great but the issue (on a couple puzzles like this) is that a person could move one piece 8 times into the same correct position and the "Great Job" message will pop up although the puzzle is visually incomplete.
View 7 Replies
Jan 6, 2010
I'm trying to make a simulation where a person can drag 2 different objects to any 4 predefined targets on the stage. Based on the position of the 2 objects there will be a different output text. I hope I described that clearly. I would also like the 2 objects to snap to the 4 targets. Im very new to AS. Im starting to be able to read it a bit but still can not wright it.
View 9 Replies
Mar 10, 2011
Release to Drop NOT WORKING on drag and drop? Or is it something else?Can be seen here:
[URL]
Code:
var origX:Number;
var origY:Number;
for(var i:uint=1; i<6; i++){
this["choice_"+String(i)].buttonMode = true;
[code]....
View 3 Replies
Nov 10, 2009
I have movie clips loading in dynamically using an XML file, and the duplicate movie clip function. I need to be able to select one of those movie clips, drag it to a desired position and have it snap to place. As for right now, I'm using :
[Code]...
View 3 Replies
May 11, 2005
i want to make flash drag a ball onpress and if its onrelease and if its on the Suquare movieclip it should stop draggin. my code is like this
[Code]...
View 2 Replies
Nov 13, 2010
I want to have an image and when I click on the image ,one can hold down the mouse and drag a copy to where ever on the stage and when one lets go, one can drag another and another with each copy still being able to be dragged after released.this is what i have but its pretty simple and doesn't work....
stage.addEventListener(MouseEvent.MOUSE_DOWN,makeA Box);
var i:Number = 1; //i will be the total number of boxes
var newBox:myMC = new myMC();[code]....
View 3 Replies
Nov 21, 2010
Im having trouble with this and its going wrong. I need to use actionscript 2 and im on flash cs3.
View 3 Replies