ActionScript 2.0 :: Make An Object Move A Set Distance On Mouse Click?
Feb 23, 2011
I'm trying to figure out how to make an object move vertically or horizontally a set distance once the object has been mouse clicked and then stop. Sounds relatively simple, but I'm pretty clueless at it.
View 2 Replies
Similar Posts:
Jun 14, 2006
i am trying to make a drawing board(like colouring book) where when i click and MOVE THE MOUSE it colours the object(more like a brush and not as a paint bucket)i would like to know how to colour objects individually(without coloring background) and the most IMPORTANT is there any way to detect what percentage of object had been colored(like if 100% of object coloured something happens!)
View 2 Replies
Apr 22, 2008
I am currently working on putting together a small game map, a map where a character can walk around and talk to NPC's and such. We've just started to I am pretty much just working with the basics here. Just started learning AS3 too. I have created an Object, in this case a circle that gets drawn when I run my AS code, the circle is drawn in the midde of my stage. What I want, since the game is Isometric and moves in those isometric lines rather than straight up, down, left, right, I want to make a funktion where, if the mouse is clicked at a location where both the X and Y coordinate is less than where the object is, then the object moves to that place.
The code I have, is as follows at the moment:
ActionScript Code:
var xNewPos:int;
var yNewPos:int;
var inTransit:Boolean = false;
[Code].....
View 8 Replies
May 26, 2009
I have a mini-project where I want to make an object grow and move to a different section of the stage when I click on it. I know how to do this part, but what I want is for it to "move" there as if it were a tween, but I want to do it with code instead of with the timeline. I want it to function exactly as it does now, but with a motion tween. I also do NOT want it to jump back to the beginning when another button is clicked, but rather play from where it is. I've also attached the FLA with this.
Code: Select alllearn.addEventListener(MouseEvent.CLICK, learnClick);
learn.buttonMode=true;
act.addEventListener(MouseEvent.CLICK, actClick);
[code]....
View 1 Replies
Feb 19, 2004
I want to make a movie object move up & down when I click on the respective buttons. Now I can do this, thats easy... but what I want is when I hold down on the buttons that it moves on its own? And I don't have to go "*clicky* *clicky* *clicky* *clicky*" (thats the sound your mouse makes) To move the object up and down. Is this even possible? (enter newbie joke here)... Heres the code I got: on (press, release, keyPress "<Up>") { _root.block._y = _root.block._y + 4;} Now the other thing I want to do is have it stop at a certain height. Both at the top and the bottom of the screen. The idea being that someone can't scroll the object off the screen online tutorials? new career move?
View 1 Replies
Jun 27, 2006
how to do an object move towards the mouse when i move the mouse the towards the object and backwards when i move the move away, something liike the menu on [URL]
View 2 Replies
Sep 1, 2010
I have an image and I need to be able to click on 2 different points within the image and be able to have it tell me how far apart these 2 points are.
View 7 Replies
Sep 5, 2011
im building my site now and i want to have background of hexagons that get visible only when the mouse is at certain distance of them, so i found out that i have to use as3, ive read some tutorials and other post and i tried the following code that i found online:
stage.addEventListener(Event.ENTER_FRAME, showDistance);
function showDistance(e:Event):void{
var distance:Number = (circle.x, mouseX, circle.y, mouseY);
[code].....
View 9 Replies
Oct 11, 2011
I am trying to have two guestures on a SpriteVisualElement which I thought should be pretty simple implemented: Mouse_Move for sweep Gestures and mouse click to enable.. So I have 2 Eventlisteners on my stage:
[Code]...
The main problem is that every type of sweeping on the screen also fires the taphandler().. how to identify the correct event? I tried to to my taphandler only if(!event.buttondown) but no success.
View 1 Replies
Apr 27, 2009
I am trying to make an object tween from its starting location to the location of a mouse click. I have a script, but it has a very annoying ease to it.I would LIKE the object to mantain a certain speed during while traveling from its starting location to the mouse click location.
View 16 Replies
May 15, 2011
how do I move a Movie Clip with a mouse click. The movie clip continues moving. I need enterframe event to move , but I also need mouse click to trigger it to move. How do I use both?
[Code]....
View 8 Replies
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
Jul 12, 2009
I've got a game were you click and a plane moves towards that spot, the problem is making it face were you clicked. i can get it so that the plane faces towards the mouse but thats not really what i want.
View 2 Replies
Apr 20, 2004
How do I get a movieclip to move to the mouse when it is clicked and released and have it rotate in the direction that it moves?
View 5 Replies
Dec 9, 2010
I'm new to Flash and Actionscript. I'm trying to move the mouse to a random button and press it to have the onRollOver and onPress functionality.
I've tried this for mouse-over:
_xmouse = randomSelected._x;
_ymouse = randomSelected._y;
Apparently, this doesn't work....
If this is accomplished, I also need to simulate the mouse click(or button press) over the button. I've tried for hours and am seeing no logical end.
I've successfully managed to call the correct onPress and onRollOver for the random button selected, but these are just the handlers for the events. I need to raise those events in the first place.
View 3 Replies
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
Mar 18, 2012
In my first AS3 project (not used Flash since AS1) I need to use a custom movie clip as a cursor and detect clicking on a button. Using the code below, the custom cursor works as expected, but I am unable to capture clicking on the button.
If I comment out the first line, the trace for clicking works as expected. I have tried changing the order of the event listeners, applying the follow to the button rather than the stage, but cannot get both to work together.
stage.addEventListener(MouseEvent.MOUSE_MOVE,follow);
start_button.addEventListener(MouseEvent.MOUSE_UP, playPhrase);
function playPhrase(event:MouseEvent) {
[Code].....
View 1 Replies
Feb 12, 2012
I am attempting to create a flash game similar to the Android (and now iOS) game Atomic Bomber, similar in concept of course. (I am unable to link a Youtube video, for concept search "Android Atomic Bomber")
My query is on moving the object to a click location, currently I am using Tween to move the object. The object is at a constant speed by default moving to the right, once the player clicks the stage the aircraft will move towards the click location:
ActionScript Code:
//Get Click Location
public function mouseClick(e:MouseEvent):void
{
[Code]....
View 1 Replies
Aug 19, 2009
I'm still new to AS3, and I was wondering how to make an object point in the direction of another object and move towards it if they are a certain distance from one another. I haven't been able to find out how to do this from the Adobe devnet, so I thought I'd ask here.
View 1 Replies
Oct 27, 2009
I have two buttons 'nextBtn' and 'prevBtn'. 'nextBtn' moves the box_mc -800px and 'prevBtn' move it 800px. How can I make it so the buttons can be clicked several times and move in 800px increments forwards or backwards. I'd really like them to slide and slow to a stop but just getting the buggers to move first would be excellent.
nextBtn.onRelease = function() {
_root.box_mc = -800;
}[code]..........
View 10 Replies
Mar 13, 2012
I need it to were MC1 moves to MC2 after i press a button.
View 7 Replies
Feb 17, 2011
What's the correct way to track mouse position, from Adobe Flash, when someone has: Started a drag within the Flash application (a MOUSE_DOWN event), Dragged the mouse outside the app or even the browser window (a MOUSE_MOVE event), and Released the mouse button (a MOUSE_UP event)? For example (imagine Stack Overflow is a Flash application):
Within the app, I'm able to track the mouse X and Y positions with a MOUSE_MOVE event listener, but I lose it when it goes outside of the browser... So, how do I track the position of the mouse no matter where it goes? For a good example, try Google Finance. Try dragging the chart around; it'll still drag around if you move your mouse out of the browser window, and the mouse will be outside of the browser when you release it.
Also, check out KOKO KAKA; If you click on the scrollbar (make the browser window really small) and move outside of the browser window, the scroll bar moves just like a real one would. I believe both only work because the MOUSE_DOWN event "captures" the mouse, allowing the Flash application to track the position of the mouse even when it is outside of the browser.
View 2 Replies
Jan 31, 2012
I'm trying to create a script that locates the objects location, and moves it smoothly out of location (but not out of stage) when the mouse is close. When the mouse moves away, the object should return to its place. I've really been searching for hours, and I cannot seem to find anything that works.
View 2 Replies
Jan 28, 2010
I have two scenes in flash - when you go to scene 2 there is a eventListener attached to the stage to move a movieclip. When I test the movie the only way the keyboard listener seems to work is if I click on the stage first, then the object will move. Is there a solution to this. The code I am using is:
[Code]...
View 5 Replies
Nov 22, 2011
I am working on a project where I have 5 equal sized panels inside of a MC that I am using the following code on the loading of MC:
onClipEvent (load) {
targetx = 650.0;
delay = 8;
}
[Code]...
What I would like to do is ALSO move the panels with left and right arrows that act independently of navigation buttons. So that if you were on panel 2 you could advance to panel 3 or back to 1. Can I assign AS to the arrows to move the MC a specified distance left or right?
View 2 Replies
May 26, 2004
Before I start I would like to point out Im new at actionscipt. I want to move an object from a to b on a mouse press using actionscript to ease out. The only threads I can find involve huge scripts I know it should only be a couple of lines!
View 1 Replies
Nov 7, 2010
I am building a sniper game and I can't figure out how to make the game make the mouse twitch, like in clear vision elite.
View 1 Replies
Oct 1, 2011
package {
import enemies.Enemy;
import flash.display.Sprite;
import flash.events.*;
public class Main extends Sprite {
[Code]...
The enemy class has a bitmapped embeded into it. I am using FlashDevelop to program. When I do something like enemy.x+=1 it works, but when I try using my tween it script the enemy stands still no matter what the position of the mouse.
View 3 Replies
Aug 18, 2011
interact with mouse using papervision 3d? I wonder how to make a movie move against mouse [URL]
View 1 Replies
Nov 23, 2011
I am working on a project where I have 5 equal sized panels inside of a MC that uses the following code to load the MC: ( it slides into place in the viewer window)
onClipEvent (load) {
targetx = 650.0;
delay = 8;
[Code].....
What I would like to do is ALSO move the panels with left and right arrows that act independently of navigation buttons. So that if you were on panel 2 you could advance to panel 3 or back to 1. Can I assign AS to the arrows to move the MC a specified distance left or right?
View 8 Replies