ActionScript 2.0 :: Drop - Gravity - Objects Will Bounce Off Each Other
May 16, 2008
I have a file where two objects fall from the top of the stage and bounce and then eventually stop (using gravity and hit test). You can grab the objects (a ball and a box --- each has a button symbol n the movie clip) and toss them and they bounce off each other and off the 4 sides of the stage. The issue is when one of the objects is dropped directly on top of the other object, after it stops bouncing, it slides down until it hits the bottom of the stage (in this case, the box slides down in front of the ball, and the ball slides down in back of the box).
Check this code onClipEvent (load) { k = .2; damp = .9; grav = .1; [Code] ...... Cos after giving the code to mc its not responding in any terms except the drag and drop to the invisible button..
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.
I am trying to create a drag and drop tutorial by building a chemistry set.
The object of the tutorial is to drag and drop the appropriate instruments onto the target to build the kit.
I have the chemistry stand which had been designated as the target and five instruments which the user can drag and drop though only one will connect to the stand and send the user to the next frame. The instruments that are not correct snap back to their original position.
This process continues over 6 seperate frames.
The whole drag and drop process works fine, the only issue is that when the user picks up the wrong instrument and it snaps back to original position, and the user then picks up the correct instrument and send the user to the next frame, the wrong instrument (only the one that was picked up) is behind all the other new objects.
How do I get the wrong object that was picked up in the previous frame to not be in the new frame?
I have also included the actionscript for both the correct and and incorrect instrument.
I am doing a lesson on electricity with my class. I have a range of electrical symbols which the kids use to create simple circuits by dragging and dropping on the interactive whiteboard. I only have one of each symbol displayed - when a student drags one away I want the symbol/object to replicate itself at the same point that one was dragged away
i want to be able to drag and drop multiple objects. In this code the Encryption_mc doesnt return to its original position.it returns to the position of the Message_mc.any idea how i can return it to its original position?
var encOffset:Point = new Point();var encOffset1:Point = new Point(); Message_MC.addEventListener(MouseEvent.MOUSE_DOWN,dragPoly);Message_MC.addEventListener(MouseEvent.MOUSE_UP,dropPoly);
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..
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] .....
I'm trying to build a drag and drop quiz where you have a list of countries, and have to drag the correct country into a blank spot in a paragraph to correctly fill out the sentence (see attached). I can get the first country to drag and drop properly. But when I tried to code the second country in the list, I get the following error message: "1021 duplicate function definition" Following is my code:
Code: // Drag a piece of garbage. rubbish_mc.onPress = function() { this.startDrag(false); }; // When the garbage is dragged over the trashcan, make it invisible. rubbish_mc.onRelease = function() { this.stopDrag(); // Convert the slash notation to dot notation using eval. if (eval(this._droptarget) == trash_mc) { rubbish_mc._visible = false; change_score(); } };
My question: I have numerous movie clips for the rubbish. Is there a more elegant way of calling them than repeating the above lines with rubbish2_mc, rubbish3_mc etc.
I have a drag and drop project using bitmaps that were masked using fireworks. All bitmaps are PNG (fireworks files) and one object is GIF. All objects were converted to movie clips.
PROBLEM: All movie clips from PNG's can be dragged, but they can't be dropped. However, the GIF movie clip responds to both drag and drop.ActionScript worked when all movie clips had GIF's. Is this problem because they objects were masked or for any other reason?
Note: Objects were masked because their border is very fussy and cropping them doesn't help with the quality of their image.
var startX:Number; var startY:Number; var counter:Number = 0;[code]...
I have been trying forever to figure out how to add multiple mc's (images) with different instance names to 1 target only (another image). All of the mc's and the target are placed on the same layer. All I want it to do is snap different images to the same target. I have tried placing the target on a seperate layer but it does not work either.
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.
I have been working with a very simple tutorial over at [URL], where you drag objects onto a target movieClip. My question is this, how do you target a movieClip inside a movie clip? What I have are 4 color squares that I want to drag and drop onto a pattern_mc. I put the target mc's with in the pattern_mc. In the tutorial the target mc's are not in a movie clip. I put my target mc's in a movieClip because I want to use the pattern_mc as a material, and I thought this was the correct way to this.
Code: //record objects starting position var startX:Number; var startY:Number; //activate objects to be moved square1mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp); square1mc.addEventListener(MouseEvent.MOUSE_UP, dropIt); [Code] .....
I am going to have what is essentially a grid of 12 boxes. 4 across 3 high. There will be an object in each box. What I want to do is to allow the user to drag an object from one box into another. This will cause the other objects in the boxes to move up one position to fill in the gap that is left by the object being dragged. I have no idea what this is called or so I don't know how to Google it.
I'm making a little drag and drop thing with fridge magnets, and I want them to react to each other. You can see it here [URL], i.e., if one is dragged over another it wont actually go over it. it'll push it away.
I am trying to make a quiz on metals. I have several elements which i want to fall into multiple target areas (e.g. the target areas are shaded grey in the following swf; metal_mc, nonmetal_mc, metalloid_mc). I can make individuals match to target areas (as there are tutorials for that) but i want each one to be able to slide in to any target area (and someday i want to create a solve button which will then place each element in the correct place). have started all over and have designated only chlorine to move (for the moment) but how do i code it to allow it to fall into any of the grey areas?
var objectoriginalX:Number;var objectoriginalY:Number;chlorine_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);chlorine_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);function
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.
i've created a sprite to drag and drop around the stage. the sprite is masked and has it's mask as it's child so that it too will drag along with the sprite. everything works fine until i add a drop shadow filter to the sprite. when the drop shadow is added, i can only mousedown to drag and mouseup to drop the sprite if the mouse events occur within the original location of the sprite when it was added to the stage.
var thumbMask:Sprite = new Sprite(); thumbMask.graphics.beginFill(0, 1); thumbMask.graphics.drawRoundRect(0, 0, 100, 75, 25, 25);
i want to improve my code for drag drop seven different or multiple objects to be moved in any three of target places then target value will be search by category or feature wise,[code]
I have been trying to develop a drag and drop Mr. Potato Head type game for a couple of days now. I am new to AS3 and I have hit a roadblock that I was hoping someone out there could help me get through. My game has 3 separate menus (mouths, hats, and eyes).Each menu is a nested MC which has several dragable objects. Unfortunately, when I move to the next frame on the timeline the object I drug out resets itself and disappears. Is there any way to keep a dragable object on the stage once it has been placed there? I think my problem is more of a logic and structure issue with the way that I set up the game rather than an issue with actionscript.
I worked on a new Flash project, but I cant seem to find a good solution for how I want my objects to collide. In my project I have: a Ball(moving object) and a Floor(not moving).
The ball is positioned over the floor and drops onto the floor through the gravity that is applied with the code.
[Code]...
Is there a way to have a global gravity in flash AS3. In which you could choose what objects you want to be affected by it? Is there a way to have a block of code that separates moving from still objects and will not let any objects collide(not overlap)?