ActionScript 3.0 :: Moving An Object To MouseX/Y With Delay?

Feb 4, 2011

I have an object that I want to go to the mouse's pointer location when it clicks on a button, but instead of it being instant I want it to have some sort of a delay, like a walking motion. I've got pretty far but I can't get the logic out of it.

ActionScript Code:
game_area.addEventListener(MouseEvent.CLICK, moveCharacter);
// moves the character to the specified click point in a delay

[code]....

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Moving Object With Delay Between Movements?

May 18, 2011

I am working on a game in which I want a movie clip to move from one random location to another, with a pause in between each movement. I have written some code with thtutorials, but I can't get it to work the way I want it to. I am extremely new to ActionScript, so I'm probably doing everything wrong. Right now all my game does is pause for a certain amount of time, and then the object just jumps from one location to another extremely quickly and doesn't stop.

//movement of searchlight
var i:int;
for (i = 0; i < 5; i++)

[code]......

View 3 Replies

ActionScript 2.0 :: Slight Delay Between Pressing The Key And The Symbol Moving?

Jul 24, 2005

Here is the code I am currently using. (The instance name being mcBox)One problem I am having is a slight delay between pressing the key and the symbol moving.Another problem is I would like the movieclip symbol to play its own timeline when a key is pressed.

[Code]...

View 2 Replies

Actionscript 3 :: Flash - Tween The Width Of Object Without Moving The Object?

Feb 23, 2012

I am trying to do a apply a tween for the width property on a MovieClip Object but every time it changes the width and the position too, and I don't want that. I want to change the width going to one side without changing the x and y of the object.

I tried both of thes and they gave the same result.

var c:Tween = new Tween(left, "scaleX", Strong.easeOut, 1, 1.5,20,true);
var c:Tween = new Tween(left, "width", Strong.easeOut, 20, 200,20,true);

I think it is applying the transformation according to a center of the movie clip. but I don't know how it can be changed.

View 2 Replies

ActionScript 3.0 :: Make A Moving Object Grip Onto And Spin Around Another Object?

Apr 13, 2011

Im working on a small project and it involves a guy which you move with the arrow keys. The arrow keys add to his x, y velocities and his position is updated accordingly. How can i get this man to grab onto an object and spin around it (like when you grab pole and letting your momentum swing you around) . I can make him grab the object but I dont know how to modify his x,y speeds to simulate the arc.

View 4 Replies

ActionScript 3.0 :: Making An Object Orbit Around Another Moving Object?

Oct 13, 2010

my title explains what im need but im using flash cs4 and heres what i have so far:

var centerX:Number;
var centerY:Number;
var centerZ:Number;

[Code].....

ok so RBall is my first moving object and my orbiting object will be called orbit

View 9 Replies

ActionScript 2.0 :: Create A Delay Via SetTimer, SetInterval Or Delay?

Feb 23, 2009

I want to create a function based (not frame) delay of about 10 seconds to the function at the start of a flash movie, the code only needs to run once.I'm very new to actionscript and have been given links to SetInterval and SetTimer examples but they all seem to be very complex.The function is below. I believe it's possible to add the commandTimer(delay:Number, repeatCount:int = 0) how me to a simple example.

onClipEvent (enterFrame) {
framePos = int(_xmouse / 100 * _parent._totalframes);
if (framePos < 0) {

[code].......

View 4 Replies

ActionScript 3.0 :: Multiplying MouseX Value?

May 13, 2011

I have this mc that responds to mouseX , only the mc is very short in frames, it's only 25 frames long. This way the mouseX is only the first 25 pixels of my stage, so it only responds to that. Is there any way I can multiply this value to, let's say, 20 times?

View 1 Replies

Flash :: MouseX Value Changes When Cursor Is Still

Feb 1, 2012

Here is my code:

public function update()
{
//making the character follow the mouse

[Code].....

mouseX isn't being changed by me (and can't be since it's read-only), there isn't any other code in this object since I've only just started with this project.

View 1 Replies

ActionScript 3.0 :: Get Touchpoints Aka MouseX?

Sep 20, 2011

Is it possible to find all touch points that are pressed down, and its x/y properties, like we can with mouseX and mouseY?

View 0 Replies

ActionScript 3.0 :: MouseX In A Class

Sep 10, 2009

[Code]...

if I want to use mouseX and mouseY in my class whats the most effective way to do this?
I know if I extend a class to Sprite for example I get this feature but could I get it with less... I know I could say this also and then I wouldnt need to extend Sprite but I dont know if this is a good idea....

[Code]...

View 3 Replies

ActionScript 3.0 :: Zoom In On Map Using MouseX And MouseY?

Mar 3, 2010

I am making a map of the united states where I would like the map to pan to that state and then zoom into that state when that state is clicked. I have looked over a lot of tutorials, but they all seem to do a little more then I need. I would have thought it was a simple math equation using the mouseX and mouseY with the stage.stageWidth and stage.stageHeight, but I have no been able to figure out the math.

View 3 Replies

ActionScript 3.0 :: Setting Bounderies For Mc Using MouseX?

Jan 12, 2010

I am trying to get a MC to stay within certain boundaries of the stage. I want it to appear as if it was in a rectangle. It moves along the x axis. Think of a paddle in a basic pong game.What this code does is moves the paddleMC to the left coordinate when the mouse is moved, then gets stuck there.Is there any way to set the boundaries for mc on the x axis when controlled by the mouse?here is my code.mcPaddle is the movieclip I'm trying to set the boundaries for.

ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, movePaddle);
function movePaddle(event:MouseEvent):void

[code].....

View 4 Replies

ActionScript 3.0 :: Character In 3D Space Following MouseX

May 27, 2011

I'm a non-3D guy with a 3D problem to solve. I have a character moving around in 3D space (his Z value is fixed, like a 2D side-scroller with 3D graphics). He's supposed to follow the mouse. But because the mouse's Z is not the same as the character's, I obviously can't just set his Z to that of the mouse. I'm pretty sure I need to use the distance between the character and the camera when calculating the character's new X position. But I'm not the mathiest person around, and the wiki article on 3D projection ([URL]) made me a little dizzy. All I know is I need to do the inverse of what that article describes.

I'm not using any 3D engines. I've found posts about certain versions of PaperVision that actually have a method built into the Camera class to do exactly this (Camera.unproject()). I'm going to attempt to dig into that to see if I can pull out the formula that I need. But in the meantime I thought I would pick the brains of you brilliant Kirupians.

View 1 Replies

ActionScript 2.0 :: Moving An Object To A Top Layer?

Feb 12, 2010

I need some AS2 actionscript that I can place on a button to move it to the front on rollover. and move it to the back on rollout.I have two identical buttons on a layer in my timeline. When you roll over a button a larger text box appears ontop of it. The text box is the rollover state on the button, which is a button symbol. This works great in itself, but the problem is that the buttons are place close together and when one button gets rolled over and the text box encroaches on the other button's space. I always want the text box and button you are rolling over to appear in front of the other buttons that are on that layer. But that's not possible, since one button will be in front and one will be behind. Is there some AS2 actionscript that I can place on each of the buttons to move the button you roll over to the front?

View 1 Replies

Flash Object Keeps Moving Position?

Jun 3, 2010

I came across a problem where my flash timer keeps changing position as the browser window is resized or if the user scrolls down the page the timer will move with it?It also changes position on different monitor screens.Is there an easy way without too much code to position it at a certain position on my page :[URL]As you can see its too low and should be in line with 'Comming soon'Im also using Dreamweaver if that makes a difference.

View 2 Replies

CS3 Moving An Object Stopped Working

Jun 11, 2010

[Code]....

I wrote it originally in as2 and I tried to translate it to as3 and it stopped working. It's suppose to move the player towards another player. this is just the part of the script that doesn't work

View 1 Replies

Moving An Object In Multiple Frames

Jun 12, 2010

I'm new to Flash and just started working on an animated short. In one of the sequences, I realized too late that an object was too far left in the frame and needed to be moved back. Is there a way to do that in all of the keyframes at once rather than doing it one at a time? The thing that needs to be moved is a .png file, not a symbol.

View 1 Replies

ActionScript 3.0 :: Moving An Object Up And Down The Y Axis?

Apr 21, 2011

i'm trying to use actionscript so i can make an object move up and down the Y axis by inputing numbers into a textbox. However at the moment my object starts in the centre and then when i enter a number it only goes down, and im not too sure how i can use negative numbers to make it travel up the y axis. I was thinking of using the numbers -10 - 10 so -10 would go down and 10 go up. Here is my code

Actionscript Code:
// EXAMPLE WHERE TEXTBOX USED TO POSITION A BALL ON THE STAGEpackage {  import flash.display.Sprite;  import flash.display.Stage;  import flash.text.*; 

[code]......

View 2 Replies

ActionScript 3.0 :: Moving An Object Around The Stage

Apr 28, 2011

i'm trying to use code so if i type in -10 to 10 the object will move up or down the y axis. The code i'm using at the moment calculates how far to move it from the number inputed, then it removes te object and places it in the required position. However doing the removeChild technique messes up when having many on the stage. I was wondering if anyone knew a way of calculating the rating and then using it to move the object on the stage without removing it and adding it. Here is the code i'm using to move it. OR a way in which i can remove certain objects on the stage using remove child

[Code]....

View 3 Replies

ActionScript 3.0 :: Consistantly Moving An Object?

May 21, 2009

Is there a way (I know there is) to use ActionScript 3 to move an object along the x axis a certain ammount of times when a person clicks the screen?  Currently, I only know how to set it to go directly to a location, not multiple.  Example:

[Code]...

View 5 Replies

ActionScript 3.0 :: Object Moving Back And Forth

Nov 28, 2009

I've been teaching myself 3d objects in Flash using the tool in the timeline and AS3.
My Problem is moving an object one way and at a specific point move back (and repeat) in AS3 here is the code. How can I move satillite.x one way and then in the oppisite direction?.

[Code]...

Is there a way to size these objects, or is it depedent on the size of the image map?

View 3 Replies

Animate Object Along A Moving Path?

Jan 27, 2011

I have a straight line that converges to a point which makes the line curve. I want an arrow to follow the converging line. Motion guides seem to only work with a defined non moving path. How can I get my arrow to follow the moving curving path?

View 2 Replies

Actionscript 3 :: Rotating Towards Another Moving Object

Feb 25, 2011

im having trouble getting this rotation function down pat. i have a turret that should be rotating towards another moving object. it should find the shortest direction to rotate. basically what ive done is converted action script rotation from using -1 -> -179 to 180 -> 359. but now im having issues when the object it is tracking passes over the zero degree point. the turrent then rotates around the other way. here is the code. my mind is getting a little boggled. it is being passed the x difference between the objects, and the y difference

[Code]...

View 1 Replies

Flash :: ActionScript 2 Moving An Object

Dec 8, 2011

I have very little knowledge of ActionScript. I have a movie clip. I want it to move along the x-axis when i press down on a button(button or movie clip) I do not know what code to use as it needs to be Action Script 2. Is there a Tutorial or something that can accomplish this? I have found a tutorial that moves the object around when you press a button. I am trying to get the same effect when you click down on a button: [URL] UPDATE The button is called btn and the object that moves is mctransparent I have managed the folowing:

[Code]...

View 2 Replies

As3 :: Flash - Moving An Object In Relation To Another?

Jan 17, 2012

i have a character_mc that moves on mouse click, a logtxt dyanamic text box and a mc named $box. The camera follows the character and when the log and $ boxes are staying put.

I want them to stay on the same point on the stage(meaning I want them to stay at the same place on the camera) I was wondering what i might do for this? I have tried to put them in a movie clip but it doesn't really seam like it worked well so i discarded the idea.

Heres the code:

package {
import flash.display.Sprite;
import flash.display.MovieClip;

[Code].....

View 1 Replies

ActionScript 3.0 :: Moving Object To A Certain Position?

Feb 3, 2009

The following code works fine when mouse is pressed at any position on the screen ,object moves that position...but what if I want the object move that position at a certain speed..say+10 using setInterval...I mean I want my object move slowly to any position I click on the screen..

PHP Code:
onClipEvent (mouseDown) {
this._x = _root._xmouse;

[code].....

View 5 Replies

ActionScript 2.0 :: Moving An Object On Mouseclick?

Aug 8, 2009

'm putting together a flash animation of approx five productsEach picture is above the other so the flash file is tall roduct 1 at the top product 2 underneath 3 underneath that etcThe whole thing will scroll up and down vertically to display each appropriate pictureI need 5 buttons each one would move the strip of images up and down vertically to the correct location and I was wondering if this would be possible by using actionscript to move and define the position on the long strip of images.I.e when product 1 button is pressed, scroll the strip up to show product 1 picture. When product 4 button is pressed, scroll the same strip down to display product 4..For example, each button script might read something likeonRelease - scroll the image bar to y position(obviously a different position for each button)would this be feesable? I hope somebody understands what I mean, I've seen these type of flash 'portfolio' type scroll bars quite a few times but I'm not sure how to go about putting one together, is this the best way?

View 6 Replies

ActionScript 3.0 :: Moving An Object A Certain Amount

Aug 26, 2009

I have a square box, which is larger than the stage. The box can be moved around the stage, using the startDrag/stopDrag methods. The box starts a 0,0 and gets moved with the mouse...

ActionScript Code:
board.addEventListener(Event.ENTER_FRAME, boardMiniMapLocation);
public function boardMiniMapLocation(e:Event){
if(board.x >= 0){

[Code]....

In the above, the first two if statements work, it is just the last one that doesn't work.

What is supposed to happen, is when the board is dragged to the left, and it hits the boards right edge is equal to the right edge of the stage, it is supposed to not allow the board to move any more to the left.

View 1 Replies

ActionScript 2.0 :: Restrict An Object From Moving Around?

Mar 1, 2010

ive made an object which can be moved by the user with the arrow keys but you can make it go off screen

View 5 Replies







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