ActionScript 3.0 :: Make A Movieclip React To Multiple Targets?

Nov 14, 2009

I was wanting some help with some of my coding I have to complete a game designed to teach students how to build a food web. This is my first use of flash Everything was going fine till I decided to go a bit more complex with the actionscript. What I have the program doing so far is when the sun2_mc1, sun2_mc2, sun2_mc3 and sun2_mc4 movieclips are pressed they turn into buttons and can be dragged. When the mc's are over the top of the target of - "target" + event.target.name - and the mouse is unpressed the mc is left in that position. At the moment the coding needs to have the mc over the exact same target of targetsun2_mc1 etc. However, I need the mc to be able to be placed over the top of all four of the targets on the background.[code]

View 1 Replies


Similar Posts:


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 :: Multiple Targets - Make A Function That Runs On Mouse Click On Either Of The Buttons

Apr 24, 2006

I have 4 buttons with instance names: 'alfa', 'bravo', 'charlie' and 'delta'. I want to make a function that runs on mouse click on either of the buttons. I tried this, but could remember exactly how it should look:

[Code]...

View 12 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 :: Multiple Targets For SetScrollTarget?

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

ActionScript 3.0 :: Lock On To Multiple Targets?

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

ActionScript 3.0 :: Assigning Same Name To Multiple Targets?

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

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 :: Way To Have The Ball Hit Multiple Targets?

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

ActionScript 3.0 :: HitTestObject With Multiple Targets?

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

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

ActionScript 2.0 :: SetProperty (multiple Targets, _property, Value)?

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

ActionScript 3.0 :: Make A Button React To Keypress?

Oct 17, 2011

I've got this piece of code which is basically a start button that reacts to being clicked on. I'd like to change that into starting the function by pressing Enter on the keyboard. I'm having trouble figuring it out since the code is already in a function. How do I make it react to keypresses?

[Code]...

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 2.0 :: SetProperty Of More Than One Instance (multiple Targets - _property - Value)?

Mar 28, 2005

got stuck with this... I've 2 mc in timeline instance names are: form1 form2 in first frame I wrote the following code

[Code]...

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

Actionscript :: Make An Object React To A Sound In Flash

Jan 16, 2010

I have a speaker and I need this speaker moves with a sound. I need to simulate the real world speaker vibration generated by the low and mid frequencies.

Does not have to be soo realistic what I whant to know is how I can play a sound and get son mumerical value usefull for apply numerical size transformation to the speaker.

View 1 Replies

ActionScript 2.0 :: Make Both Ovrlapping Movieclips To React To Same Mouseclick?

Nov 25, 2009

if I have two overlapping movieclips and both have onPress function, then the upper movieclip screens the lower one so that the lower movieclip does not react to Mouseclick.

Is this a default behavior?

Is it possible to make both ovrlapping movieclips to react to the same mouseclick?

View 2 Replies

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

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 :: Make Scroll Bar React To Dynamic Textfield Movement?

Jun 7, 2010

I've been looking for a tutorial and answer to this for a while but can't find what I'm looking for. I am loading html text into a dynamic textfield, and I have a scrollbar controlling the scroll using the code below. What I want to do is also add scroll up/down buttons and have the scroll bar move in relation to the text scroll. I was just going to use "tracklistingtext.scrollV -- " for the scroll buttons, but right now the scroll bar doesn't recognize the text movement. What do I need to do to get the scroll bar to listen to the text scroll position?

var listTextreq:URLRequest=new URLRequest("tracklist.txt");
var listTextLoader:URLLoader = new URLLoader();
var bounds:Rectangle=new Rectangle(scrollMC.x,scrollMC.y,0,300);

[Code].....

View 1 Replies

ActionScript 2.0 :: Get A Movieclip To React To Mouse Within A Certain Area (swf In Html)?

Oct 27, 2009

I got a problem with a rotating cube in html.When i'm out of the swf area, the _ymouse and xmouse are still reacting when i click somewhere outside of the swf and then the cube starts rotating again.Is it possible to limit the mouse coordinates to only the swf file?The cube i'm using is on this site.URL...

View 4 Replies

Make Entire Group React On Mouse Over / Not Individual Movie Clips Themselves

Dec 10, 2009

i have a bunch of movie clips and in order to make them rotate the way i want i have grouped them together, made the entire group into a movie clip and applied the motion tween. I'm trying to code it so that when i mouse over the movie clips WITHIN the group movie clip, something happens. How would i go about it? All i can work out is how to make the entire group react on mouse over, not the individual movie clips themselves.

View 2 Replies

ActionScript 2.0 :: Make A Interactive Animated Character, That Would React To Clicks In Certain Places?

Nov 26, 2006

I need to make a interactive animated character, that would react to clicks in certain places, but instead of bitmap/vector animations, there would be video clips embeded in the swf. The video clips would be played in various combinations.Let me give you a example.

Start: A looped video of a person idling.

Start/hotspot1: The looping video fades-out, and a video of a person jumping up fades-in, plays, then fades-out back to the loop.

I have to embed the videos, so that there won't be any buffering. I tryed to embed the video, and use commands like gotoAndPlay(), gotoAndStop(), play(), stop(), but if I have more than one embeded video I start having problems controlling the clips.Here's one of my unsuccessfull attempts:

Clicking on the HS1, should fade-out VIDEO1, fade-in VIDEO2/play it/fade-out, and fade-in VIDEO1 again.

View 1 Replies

ActionScript 2.0 :: How To Make Movie Clips Snap To Their Targets

Jul 23, 2008

I am using Flash CS3 with AS2 and I have made a drag and drop. Everything works fine, but I don't know how to make my movie clips snap to their targets.[code]

View 3 Replies







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