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


Similar Posts:


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

Professional :: Make Code Which Runs Every Time The Mouse Is Clicked Anywhere

Jan 6, 2011

How do I make code which runs every time the mouse is clicked anywhere (not on any specific object) using AS1

View 1 Replies

ActionScript 3 :: Anonymous Function As Click Handler Is Called Multiple Times Per Click

Aug 16, 2010

I have a button labeled 'blueButton' and I'd like to use an anonymous function to handle the click, like so:

blueButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
trace( "-----click detected-----" );
// now do other stuff
});

Problem is, the click handler is called multiple times per click. The number of times called seems to be random (sometimes 2, sometimes 4, sometimes 3 etc). could I be missing something in my code, or maybe I set up the button wrong?

also I noticed that it seems to always get called once on the first click. After the first click is when it starts getting called additional times, maybe that has something to do with it?

View 3 Replies

ActionScript 3.0 :: Make The Mouse Click Event Recognize When Click Anywhere On The Screen?

Jan 26, 2012

I just started playing around with as3 and I have a function for mouse clicks that draws a shape on each click. However the mouse click event does not appear to work unless I click a movieClip object I placed in the middle of the screen. Is there a way to make the mouse click event recognize when I click anywhere on the screen?

[Code]...

View 2 Replies

Using Multiple Movie Clips For Separate Buttons And Mouse Over Buttons?

Nov 24, 2009

I am using Flash CS4 with ActionScript 3 and I am fairly new at it. I am struggling with two things.
 
1. How can I start a movie clip while scrolling over a button? I know how to start a movie clip when a button is clicked.
 
2. How can I use multiple movie clips for seperate buttons?

[URL]

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

Professional :: Make Buttons That Animate On Mouse Over Go Back To Original State *smoothly* On Mouse Off?

Aug 26, 2011

The title pretty much sums up what I am trying to do: I haven't started digging into using script in Flash yet, still being very much a beginner.
 
I created a simple file using movie clips nested in buttons so that when I mouseover a letter, it bobs up and down, but I can't work out how to make it return to its original "up" state *smoothly* when the mouse is moved away. If it must involve script please be aware I am a total noob!

View 9 Replies

ActionScript 3.0 :: Mouse Click On Buttons Isn't Working

May 3, 2010

It seams my event listener for a mouse click on buttons isn't working. I gave the buttons instance name two_btn, etc, then I wrote in action script:[code]but every time I click the button it won't do anything at all.

View 9 Replies

AS3 :: Buttons - Move An Image Up Or Down On Mouse Click

Sep 21, 2010

I have 2 buttons that i made an up arrow and a down arrow. I would like them to move an image up or down on mouse click. Although i made the button rollover actions previously and i got the script below from researching online. Now I am not sure if i should even bother with it. I thought if i could get the actionscript to recognize the buttons and tell it what to move the (the ad) I could get them to work. But haven't figured out how to do that and if i have to make custom buttons for this. see what i have below thus far.

[Code]...

View 3 Replies

ActionScript 2.0 :: Click Tag Buttons And Other Mouse Events

Jun 26, 2007

Banner ads have buttons that ad serving systems use the following syntax to dynamically assign a URL.[code]The clicktag button covers the stage (ad size) and prevents other mouse events like panning. Are there any hacks to get around this? I have a FLA that uses the following AS but the mandatory click tage button disables it the panning functionality.[code]

View 1 Replies

IDE :: CS4 Click Targets Another SWF On Same HTML Page To Animate?

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

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

AS3 :: Getting The Mouse Targets Children One Level Deep?

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

AS3 :: Professional - Flash - Incorporate A Right Mouse Click Function

Mar 23, 2010

I am working on a training simulation and would like to incorperate a right mouse click function. I have been using the code below with no problems.

[Code]....

View 6 Replies

ActionScript 3.0 :: Retrieving A MovieClip's Name From A Mouse Click Into A Function?

May 20, 2009

I'm not proud of my subject line, but it was the best I could do.I'm using this while loop to activate the function buttonpressed from one of five buttons named thumb0, thumb1, etc.:i = -1; while (i++ < 4){this["thumb"+(i)].addEventListener(MouseEvent.MOUSE_UP,buttonpresse d);}I want the main timeline to jump to the labeled frame corresponding with the targeted button's numberfunction buttonpressed(evt:MouseEvent):void{MovieClip(root) .gotoAndStop("clip"+[i]);}

View 2 Replies

ActionScript 2.0 :: When Click Link 1, It Runs *behind* The Other File?

Feb 17, 2005

As you can see from the attached load.swf, when I click on link 1, a blue movie 'runs in', and when I click link 2, an orange movie 'runs in'. Alls well right? Unfortunately, when I click link 1, it runs *behind* the orange file, so it can't be viewed.What I want to achieve here is that with every link I click, it overlaps the prev file, but the method I tried here only works if the user *nicely* clicks from link 1 to link 8, and not randomly. Any ways to go about this?

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

IDE :: One Function, Multiple Buttons

Nov 16, 2008

I have three buttons. My goal is that each button will load and play a sound file from the internet. Here is what I have:

function loadPlaySnd(pSpecifier1:String):void {

arguments;

SoundMixer.stopAll();[code]....

Every Button I press goes to the same sound file. The best I can figure, is that the file I loaded the first time I pressed a button has been uploaded, and from there I cannot load another file over that variable when I try another button.

View 2 Replies

ActionScript 2.0 :: Make The Butterfly Disappear On Mouse Click?

Mar 28, 2012

how can i make the butterfly disappear on mouse click in this simple work ?

View 2 Replies







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