ActionScript 3.0 :: Moving Objects In A Straight Line?

Jun 22, 2009

I have this code inside an ENTER_FRAME event. I'm trying to move the "ball" from its x- and y-position to a tartget x- and y- position:

Code:
if (processClick)
{
if (ball.x < targetX) ball.x += 8;
if (ball.x > targetX) ball.x -= 8;

[Code]....

But the "ball" doesn't move in a straight line, I think it is because the x- and y-movements are processed independently?

Is there a way thay I can make the "ball" move in a straight line from the starting point to the target point?

Also, is there maybe a way to manually create a tween between the starting point and the target point using actionscript? If I export the "ball" movieclip for actionscript?

View 4 Replies


Similar Posts:


ActionScript 2.0 :: Straight Line Will Follow Their Mouse Until They Click Again And This Releases The Straight Line?

Jan 30, 2009

I've managed to follow some drawing tutorias which work fine (mouse down draws a line everywhere you move mouse like MS paint).I would like to adapt this now if I can so that when a user clicks down, a straight line will follow their mouse until they click again and this releases the straight line. This should leave one line on the screen, then they are free to move their mouse and repeat the action again.

View 6 Replies

IDE :: Moving A Movie Clip Across The Screen In A Straight Line

Jun 7, 2009

I am trying to move a playing card across the screen from the deck to the players hand. The deck is in a stationary position and each player has 2 card places in front of them which are also stationary. The deck is a movie clip called "deck" and the player cards are named "p1c1" and "p1c2"....(player # card #). The animation I am trying to accomplish is to duplicate the "deck" movie clip and move it to the players card. Once it reaches the players card, the stationary card will load the card image and the duplicated movie clip will be removed to make it appear as a smooth transition.

View 11 Replies

IDE :: Moving A Movie Clip Across The Screen In A Straight Line?

Jan 25, 2011

I am trying to move a playing card across the screen from the deck to the players hand. The deck is in a stationary position and each player has 2 card places in front of them which are also stationary. The deck is a movie clip called "deck" and the player cards are named "p1c1" and "p1c2"....(player # card #). The animation I am trying to accomplish is to duplicate the "deck" movie clip and move it to the players card. Once it reaches the players card, the stationary card will load the card image and the duplicated movie clip will be removed to make it appear as a smooth transition.

View 1 Replies

Flash :: Using The Pen Tool - Line Automatically Connects Between The Two Points In A Straight Line

Jul 3, 2009

I'm in the process of teaching myself the components of the CS4 Design Premium package using the Adobe Classroom in a Book series. I'm currently going through the Flash CIAB and i've started using the pen tool. The task involves creating a wave like design across the stage. Whilst this in itself is simple, the final instruction is to click on the first anchor point to close the shape. In the illustration, the closed shape seems to automatically extend around the stage, however when I click on the first anchor point, the line automatically connects between the two points in a straight line.

Am I doing something wrong? The next step is to fill this area, but with the straight line effect that I am getting, this becomes impossible. I should point out that the instruction states that the pen tool line should extend off the stage. I have done this, but even then on clicking on the first anchor point the shape is closed incorrectly.

View 2 Replies

ActionScript 3.0 :: Draw A Straight Line Then Drag Out A Dotted Line?

Feb 3, 2012

I'm trying to produce a game that on mouse down a dotted line (or just a line) gets dragged out following the mouse until it is realized then it disappears.

View 1 Replies

ActionScript 3.0 :: Drag In A Straight Line?

Jan 6, 2011

I know you can restrain an mc in a rectangle when using startDrag, but is there a way to have the mc only go horizontal or vertical without going off diagonally? Sort of like a slider that can only move in a straight line in four directions (like a cross).

View 4 Replies

ActionScript 2.0 :: Drawing A Straight Line?

Jan 30, 2009

I've followed the drawing api tutorial off here for MX and have got that working perfectly. I would like to adapt this now if I can so that when a user clicks a straight line will follow their mouse until they click again and this releases the straight line.

View 2 Replies

ActionScript 3.0 :: Draw Straight Line And Snap To That Point

Nov 19, 2009

I am very new to actionscript 3.0 & currently i have a project to do that required actionscript.
ActionScript Code:
package{ //package
import flash.display.Sprite;// for sprite, to prevent 1046 error code
import flash.events.MouseEvent; //for mouseEvent, to prevent 1046 error code
import flash.display.Shape; //for shape, to prevent 1046 error code
public class gridDrawLineTesting extends Sprite //for mouseX mouseY
[Code] .....

This is the code that I have found from various web and paste it into one. I want to draw straight line & snap to that point at the same time. My problem is when I click at 2nd point, there is a 'extra' line at (0,0) joining towards my 2nd corrdinate point. I want to get rid of that 'extra' line.

View 6 Replies

ActionScript 2.0 :: How To Make Object Travel In Straight Line

Jan 3, 2012

How do you make an MC travel in a single straight line (not two, not three, only one) according to mouse position and current position?

View 3 Replies

ActionScript 2.0 :: Straight Line Slowly Curving To C Circle?

Feb 7, 2006

I want a straight line to slowly curve so it become a circle. Can yo do that with actionscript?

View 5 Replies

ActionScript 3.0 :: Flash Button Use - Text To Be Displayed As A Paragraph Not A Straight Line

Mar 24, 2011

i am still new in dealing with flash and what have you posted is very useful, but i want to ask you a question regarding the button function. i want to relate a button with a certain text but it's a big paragraph so when i have made the example on the site the display in the output box is not good enough i want the text to be displayed as a paragraph not a straight line.

View 1 Replies

Actionscript 3 :: Wait For Each Line Of Code In A Function To Be Executed Before Moving On To The Next Line?

Jun 29, 2011

I am trying to dispatch an event but not sure when I should do it to get the right results. The first event "submitClicked" is in the right spot and works great. However, the second event "dataReady" seems like it might be a problem. I need it to be dispatched after this.compiledFormData is set.Does AS3 wait for each line of code in a function to be executed before moving on to the next line?

// --------------------------------------------------------------------
public function submitForm()
{

[code].....

View 2 Replies

Actionscript 3 :: "Merging" A Straight Line Into A Gaussian Curve?

Mar 5, 2012

You can assume that the first image below is the original Gaussian curve. The second image is the desired output. I have these equations:Equation of each red line segment (let's call this the piecewise function f(x))Equation of the Gaussian curve (g(x)) am trying to make an equation that can alter the Gaussian curve to match the curve in the second image. I have tried plotting (f(x) + g(x)) / 2 (last image) but it doesn't do the trick. I have also tried using the red line segment on far right as the independent axis for plotting the right part of the curve but that leads to a huge discontinuity.

View 2 Replies

ActionScript 3.0 :: Curve A Dynamic Text From A Straight Line To Circular Curve?

Sep 9, 2009

I want to curve a dynamic text from a straight line to circular curve (using a slider). I have placed the characters of the string in each textfield created at runtime.

View 3 Replies

Tween A Line That One End Is Moving And The Other Is Fixed?

Mar 2, 2012

i wanna do the shape tween or should i say tween a line...one end of the line should stay still while the other should expand and contract moving on a designated path..so its not just an shape tween where line will expand..i want the moving end to go along some path.

View 14 Replies

ActionScript 3.0 :: Draw A Line That Keeps Moving Using Just It?

Feb 22, 2011

I'm trying to draw a line that just keeps moving using just AS3. Like when a heart beat monitor flat lines. The reason is I'm adding this to arduino project so when you breath into an alcohol sensor the line will move up if you have been drinking. I just want to be put on the right path.

View 1 Replies

ActionScript 3.0 :: Moving A Line In A Circle?

Mar 2, 2011

I am trying to move a line around in a circle, around a fixed point (not 0,0). As in the way a clock hand moves around with one end at the middle and the other end traveling in a circle. I tried the rotation function but that moves the entire object around (0,0), I need the point in the middle stationary and at a non (0,0) point.

View 9 Replies

ActionScript 2.0 :: Moving A Line Like A Flag?

Jul 2, 2003

you know when a flag waves? the movement of an eel? a sperm tail?

that is what i am trying to accomplish. that movement.

other than very rough tweening i am not getting close.

View 4 Replies

ActionScript 3.0 :: Draw A Line Following A Moving Point?

Apr 12, 2011

I have a motion tween right now with a moving point that is following a copied and pasted motion path. Is there a quick way to have the point draw a line behind it as it moves along the motion path??? I can't seem to find a good way to do it in AS3.

View 1 Replies

ActionScript 3.0 :: Moving Sprite Along Drawn Line?

Sep 18, 2009

I want to the user to be able to draw a line and then have a sprite follow the line as its path. Also, it would be nice if the line could be cleaned up after the user draws it with his/her mouse so that it is made up of clean curves/spline.

View 1 Replies

ActionScript 2.0 :: Create A Random Moving Line Along The X-coordinate

May 9, 2003

im trying to create a random moving line along the x-coordinate that with each cycle will move for a random distance at a random speed. i can generate the ranom distance and speed just fine, but i cant get the speed to apply the movement for then length of the distance. i have tried using a for loop:

[Code]....

View 4 Replies

ActionScript 2.0 :: [CS3] HitTest On Moving Objects?

Jan 22, 2009

I'm making a game where a character moves around a level and stays in the centre of the screen as the background scrolls past. I have created a movie clip of an enemy that moves up and down, and used hitTest to stop my character flying through the enemy and also to deduct a point from the score. However, if my character hits the enemy and stays underneath him, the enemy's movement pushes my character out of the screen, and you can no longer see him.

View 3 Replies

Professional :: Objects Moving 360 Degrees?

Feb 1, 2010

i'm not quite sure which forum to use, so therefore I post this discussion here. I want to animate an object that is turning 360 degrees around.

[Code]...
 
It does'nt need any navigation like this example, but it's going to just an animationmovie.This animation is going to be viewed on a widescreen tv. How do I make the animation fit the screen? I'm not sure which resolution the animation must be. I guess this has to match the resolution of the tv. But is it just as simple as changing the flash file settings in 1920 x 1080?

View 6 Replies

ActionScript 3.0 :: Two Objects Moving Around With Mouse?

Nov 25, 2011

I'm making a catching game and I only wanted the falling objects hit certain area on my catcher. My catcher is a girl with mouth open and I wanted the falling objects to hit only the mouth, not any other parts of her body like arms. So I made two objects, the full girl and just the mouth. How do I make the two objects (movieclips) move around with the mouse?I tried to embed one object into another but it didn't work....

This is actionscript I wrote so far:
package {
import flash.display.*;

[code].....

View 6 Replies

ActionScript 3.0 :: Collision With Moving Objects?

Jan 16, 2012

I'm having a little problem with collision detection. I'm currently with very simple game, where the only thing that is off is the collision.I tried with hittestobject and (as I found) it checks for the outer layer (my objects are a circle, and a weird star), so this method was of no use to me. Then I tried with hittestpoint, and I found that it checks for the center of the objects, so game over happens only where the center of an enemy touch the center of my character.I know that I must have something missing and I found a lot of guides but all of them were with squares or with static objects

View 3 Replies

Flash :: Moving 2d Objects On A 3d Plane?

Jun 11, 2010

I have a 2d plane rotated on its x axis, with 2d display objects I want to move around on the plane. Its pretty similar to a chess board [URL]..

The board is a rotated rectangle, and the pieces are just 2d display objects. Whats the easiest way to manipulate those objects so they appear to be moving on the board?

View 1 Replies

Flash :: Moving Objects With Timer?

Sep 1, 2010

I have this class named MovingObject which extends the MovieClip class. This class will be instantianted for several times. Inside this class is a Timer that handles the speed of the objects moving. There is another class called TheStage and this is where I will instantiate MovingObject (s).

public class MovingObject extends MovieClip{
public var tmr:Timer = new Timer(1);
public function MovingObject(){

[Code].....

Assuming that the code is working fine (I haven't debugged it), this makes the particles to move all at once. However after several seconds of running it, the particles seem not to be moving in synchronization with each other (because their distances between seem to get nearer).

View 2 Replies

Flash :: Moving Objects In Array?

Apr 14, 2011

I have an array wich is filled with platforms that are supposed to move.

var MovingPlatformArray:Array = new Array();
for (var c:int = numChildren - 1; c >= 0; c--){
var child3:DisplayObject = getChildAt(c);
if (child3.name == "movingplatform"){
MovingPlatformArray.push(child3);

[Code]...

Right now I have 2 moving platforms in this array. But only one moves up and down. But they both register a touch with the birdie.

View 3 Replies

ActionScript 3.0 :: Moving Objects Using X,y Coordinates?

Jun 23, 2009

I have a MovieClip on my stage. Inside the MovieClip there are a few buttons (all MovieClips also) and a mask layer to keep anything on the outside invisible.

Problem: My MouseEvent fires and should move objectA into position over objectB. All code in the script tells me it has moved. Tracing the x,y coordinates of objectA also tells me it has moved. The Alpha on objectA is 100% and it is positioned on the topmost layer beneath the mask layer. All this tells me that when the object moves, it should be visible on the stage (the event moves the object into the masked area). Testing disproves everything. The traces all tell me the object is where it is supposed to be but it cannot be seen. I don't understand this and it, amongst other AS3 hiccups, is seriously turning me off Flash as it seems to be a waste of time to try and learn as it seems like 90% of the scripts written will fail 90% of the time.

View 3 Replies







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