ActionScript 2.0 :: Multi HitTest Targets?
Jul 24, 2009
I am currently making a game involving matchsticks. i have the dragging of the matchsticks working. But now i would like to know how to check if 2 (or more or less depending on what level) of the possible matchsticks are dropped on the target. When the right matchsticks are drop in the right places i will put in an action like "gotoNextFrame" or make the continue menu visible.
View 9 Replies
Similar Posts:
Jun 20, 2007
I'm trying to use hitTest to detect if a dragged clip is over any one of 3 different targets - when it is I want that target to blink. And then when I drag off I'd like the blinking to stop. Make sense? I'm struggling a bit with the following code:
Code:
square_mc.onPress = function() {
this.startDrag();
for (z=1; z<4; z++) {
circle = _root["circle"+z+"_mc"];
[code]....
The "eval(circle)" part isn't really working.
View 4 Replies
Jan 15, 2009
i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).
View 1 Replies
Feb 8, 2010
i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;
[code].....
View 1 Replies
Aug 4, 2009
I am trying to improve a basic paddle ball game by adding one or more targets to be hit by the ball during the game. The idea is targets appear and then when hit by the ball, the player's score is incremented then target is destroyed.
The problem is that a test for collision of ball with target gives an error during compile time as the target does not exist yet. On declaring the target at the start of the game but adding to the stage after a time, still creates the target at position (0,0) as follows[code]...
View 3 Replies
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
May 18, 2007
I'm using this actionscript at the moment:
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.
View 1 Replies
Oct 31, 2002
Does anyone know if there is a way to have 1 scrollbar scroll more than one textfield? (I'm trying to create a shadow in my textfield thisway, but the scrolling seems to cause some problems here..)
View 3 Replies
Jul 31, 2009
This is for a fretboard type game, I want six dots (fingers) to lock on to any of the 6 targets. This code doesn't seem to work, instead of locking on to each target, the fingers lock on to the last one (target6_mc) and whenever they are droped over the other targets, they just locks on to target6 again. any suggestions? Excuse the noobness
Code:
package
{
[code].....
View 3 Replies
Feb 3, 2009
I tried the drag and drop demo at [URL]. It works well allowing me to drag an item and have it register when it is dropped on the correct target. I want to modify it so that I can drag an item to multiple locations... not just one. My desired application is the ability to drag pendents or charms onto a bracelet or chain and have them "snap" to the chain. With the above demo, I can see how 90% of it would work, but I cannot figure out how to have multiple targets named the same. The bulk of the code is attached.
The line I believe needs to changed is this one:
if (event.target.dropTarget != null &&
event.target.dropTarget.parent == myTarget){
I need this part :event.target.dropTarget.parent == myTarget
to read something to the affect of:
if item being dropped is over object A OR object B OR object
C OR object D than ... rest of my code
View 7 Replies
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
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
Jul 27, 2009
I'm running a hitTestObject for when ball hits target1 - The working code works great below.
Is there a way to have the ball hit multiple targets? Instead of hitting just target1 can it return when it hits target1, target2, target3..etc.
[Code]...
View 2 Replies
Oct 19, 2009
Is it possible to link a scrollbar to two targets?
In other words, I want one scrollbar to scroll two textboxes at the same time.
If I do it with the component inspector window I cannot get it to work. Is it possible to do this in code?
I know I have the option of using a scrollpane but I am trying to avoid this because the way the code is already set up.
View 0 Replies
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
Nov 16, 2011
simply set: I do have a dragable movieclip (mcMagniDisplay) which is generated on the fly while initializing all my variables ... and I do have 4 circles (mc_boxXHitCircle) which are already placed at the bottom in the stage in advance.All I need to do is check, wheter the mcMagniDisplay is hovering one of the circles or not.
********************** code snippet ***********************
var mcMagniDisplay:MovieClip = new MovieClip();
stage.addEventListener(Event.ENTER_FRAME, hitTest);
[code]......
View 5 Replies
Aug 4, 2003
here is the code i have,
on (press) {
startDrag (this, true);
}
[code]......
View 4 Replies
Feb 25, 2010
I have produced a Flash movieclip, containing a fair few layers, including masked layers, actionscript etc. One of the things it does is allows the user to click and drag a number of movieclips and drop them anywhere within the mc, but if they drop them on specific drop targets then some actionscript kicks in, stops the drag object from being draggable again and advances through its frames to basically 'enlarge' the drag object and play a sound to show the user they've hit the right mark.
This all works perfectly on its own, or in a browser window etc.
The problem I have is when I try to insert the Flash movie into an Adobe Captivate 4 e-learning package. Things work ok apart from when you drop the dragged object onto a drop target, nothing happens. The actionscript doesn't execute.
Would the fact that the movieclip is (probably) sitting within a container (the Captivate e-learning package)? If so, how do I get around this issue?
View 1 Replies
Feb 3, 2011
i am trying to create a game for my family website, it will look the picture below but instead of paper targets i want to use photos of family members. I have no real flash experience, could somebody give me a good starting point.
View 1 Replies
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
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
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
Jan 24, 2011
I want to find only the first level of children. Right now I'm using e.target.name but this is also catching those targets children. How would I prevent this?
View 2 Replies
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
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
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
May 17, 2010
I want to create 2 separate SWF's placed in specific locations on an HTML page. When you click on the one SWF it targets the other SWF to animate. [URL]
View 1 Replies
Apr 19, 2011
I have 2 or more objects created dynamically on stage. Each object has other smaller objects as children (I called them targets).What I am trying to do is to draw lines between these targets.By the way, in the near future these parent objects will need to be drag around the stage and the lines will need to relocate to the new locations when the dragging is complete.But at this point I am having problems getting the lines to show up in the proper locations.So this first piece of code creates the targets and the second piece is where I am trying to draw the lines between targets. I tried to use localX and localY but I can't get it working.
Code:
function handleSubmitFile(evt:Event):void
{
var numberChoices:uint = mcAttribute1.comboAttribute.selectedItem.data;[code].....
View 1 Replies
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
Mar 28, 2005
I've 2 mc in timeline instance names are:
form1
form2
in first frame I wrote the following code
setProperty(form1, _alpha, 50);
setProperty(form2, _alpha, 50);
this works ok. but the question is... multiple targets, how could I do something like this:
setProperty((form1; form2), _alpha, 50);
although I know this doesn't work... how could I setProperty of more than one instance?
View 4 Replies