ActionScript 2.0 :: Move A MC In A Specific Direction?
Aug 5, 2011
I have a MC with a ball-movement, that I'd like to move in a specific direction, anytime on pressing A. Here's my code so far (the target is the center of the paddle); but it only does the last part and reverses the current direction.
ActionScript Code:
on (keyPress "a") {
endX = _root.pad._x;
[Code]....
View 4 Replies
Similar Posts:
Jan 19, 2010
i'm trying to work out how to get a movieclip (of an arrow) to rotate then move in the direction it is pointing, controlled using the keyboard. Below is the code i have written so far, I can't get it to move in the correct direction. I also can't get it to keep moving after only one key press.
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressDown);var stageW:uint=stage.stageWidth;var stageH:uint=stage.stageHeight;
var speed:Number = 5;
var angle:Number =45;
[Code].....
View 5 Replies
Sep 6, 2005
I would like the Ball to move in a random direction 0-360,Then i would like the Ball to richoche off of the BallBoundry in its reflected direction.
View 2 Replies
Apr 29, 2009
I'm moving a movie clip using actionscript (as2) instead of a motion tween (because I want to save file size) and I have this code on the first frame of the main timeline ("stone" is the movieclip instance name) and it tells the movie clip how many pixels to move in the x direction:
Code:
xTargetstone = 600;
I have this code on the movie clip itself ("stone" is the mc instance name) to handle the actual moving of the movie clip:
Code:
onClipEvent (enterFrame) {
xstone = getProperty(_root.stone, _x);
movestone = _root.xTargetstone - xstone;
setProperty(_root.stone, _x, xstone + (movestone/5));
}
The movement works fine, but the issue is that it starts out fast and then slows down over time (even though that amount of time is small). The result is that the movie clip seems to wiggle and vibrate before it stops. Is there a way for me to change the code so that it doesn't wiggle and vibrate? perhaps something with the math I'm just not totally understanding? I would like a nice consistent motion from start to finish, while being able to set the time it takes to move etc.
View 4 Replies
Apr 20, 2004
How do I get a movie clip to move to the mouse when it is clicked and released and have it rotate in the direction that it moves?
View 5 Replies
Oct 15, 2010
what i am trying to do is make a circle turn and act like a wheel... what code would i use to make a circle turn and move in the direction it is turning while on the ground?
View 12 Replies
Feb 3, 2009
Basically after adding an object on stage (using actionscript), it will be situated at a random rotation angle using:
this._rotation = Math.random()* 360;
After that, I want my object to move in the direction that it is facing, (using onEnterFrame?). How do I do that?
View 0 Replies
Sep 7, 2011
is there a easy way to make an object move along the x axis in one direction then when it reaches that direction it moves back. with a smoove movement.
View 1 Replies
May 2, 2009
Does anyone know the algorithm used in this image panner [URL]
How to move the image in the opposite direction of mouse.
View 14 Replies
Dec 2, 2011
I want to know if there's a way to make a symbol move the direction it's facing.I have a character which rotates when you press Left/Right:
if(Key.isDown(Key.LEFT))
{
_rotation -= 15;
[code].....
View 6 Replies
Sep 17, 2010
I have this code to add my missile to the screen PHP Code:
[Code]...
it adds right where my character is but I cant seem to figure out how to get the missile to actual move in the direction the character is facing. heres how it looks [URL]
View 1 Replies
Nov 15, 2004
[URL] i assume it's a series of frames with slightly different photos of the razor. when you play the movie it looks like it is spinning. my question is, how do they get the movie clip it to play forward when you move the mouse in one direction, and backward in the other? is it something like mouse over to the right and left (i'm bad with the direction code)??
right now i have a version that will play the movie clip (it's a button w/ only a hotspot) on mouse over and it will stop when the mouse os off the hotspot, but i can't get it to work like the headblade example. because i don't know the right code to play forward and back etc on mouse moves.
View 2 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
Feb 24, 2009
i have a scroller developed in as2. it basically scrolls continuously in a direction until the direction of the mouse is changed. the images of course loop in the continuous scroll. now the problem is that for 10-15 photos its ok. but when i feed it with 180 photos, it seems to show only 11. why would this be? any restriction on flash ??
View 1 Replies
Dec 2, 2009
How do you move a child, For example, I use the drawRect command, and have a rectangle, how do I have it move
View 1 Replies
Dec 1, 2010
i want to make 3 objects move in a square pathi tried to use guide layers but it didn't work good for both three objectsonly the first object followed the exact pathis there some other way to do it??
View 6 Replies
Mar 17, 2011
have a ball with the name of mc which can be moved using the keyboard .. when you press the left mouse button shoots the ball, this ball and the other flies in the face where the cursor was in the shot .. but if you move the cursor to another location and shoot a second time then the second ball is also flying in the direction of the cursor and the first ball change direction toward a second shot ..
ActionScript Code:
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
[Code]....
how to make that first ball did not change its direction and continued to fly in the direction of the shot?
View 5 Replies
Apr 25, 2011
How to get all child ids of myCanvas1.Also for a specific mxml tag say <mx:Move /> how to get its id from action script
<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[code]....
View 2 Replies
Nov 15, 2009
I'm working on this scroll from tweener [URL]. I've made a button that lets me reach the position I want on the scroll
Code:
this.bout.onRelease = function() {
this._parent.gotoPosition(4);
};
Now I'd like to load a movie when I move to this or that position. Maybe with if?
Code:
this.bout.onRelease = function() {
this._parent.gotoPosition(4);
if (_root.Position=4) {
loadMovieNum("test.swf", 1);
}};
but this doesn't work (it loads the movie alright but not because of the position).
View 1 Replies
Jul 14, 2011
how to make one object move to a specific point with animation in Actionscript ( not MXML code ) ? ( Flex 4.5 )
View 4 Replies
Jan 12, 2011
I have this code below on this button that is inside of a movieclip. I just want this button to do is move the main timeline to a specific frame thats all.
[Code]...
I didnt put i a object name before the addeventlistener because I'm not sure what to put because if I put "this" the other buttons will bt controlled by this code and if i put "parent" only that button will work.
View 7 Replies
Apr 26, 2004
Can I do this in flash? which is the best way to do it? I have a main mc and I want to duplicate it and then move it in specific area..
View 12 Replies
Jun 18, 2003
I have an object that moves around, and once it is pressed, I want it to move to a specific place and then continue to the next frame in the movie clip. This is what I have : a movie clip, the first frame has the stop(); command and contains approx 12 frames. The MC has this script attached to it :
onClipEvent(enterFrame){
if(_x >= 0){
_x = _x - 10
}if(_y >= 0){
_y = _y -10
}if(_x == 0 && _y == 0){
gotoAndPlay("/ball",2) // ball being the instance name of the mc
}}
The first two parts do move the object to where I want it but the third part will not work and I cant get it to move past frame 1. (Note : 0,0 is not the place I want it to move to, it is there because I was experimenting with the code and this was an easy place to assign to the movement).
View 14 Replies
Apr 26, 2004
can i do this in flash?i have a main mc and i want to duplicate it and then move it in specific area.
View 12 Replies
Aug 18, 2004
for a menu i use 3 MCs, when you click one of them, the two others MCs will make place for the 'options' of the clicked menu. What i want to do is give a specific _x and _y coordinates for the menus to move at when the other one is clicked (start and arrival, and have a motion tween between them). see what i mean?
View 4 Replies
Jun 28, 2010
Say for example I have a ball and I would like to move it towards a specific angle and a specific magnitude I would use something like:
[Code]...
Now if I wanted to change this force, for example, add a force to it, say, with magnitude 0.5 and angle 20, how would I do that?
View 2 Replies
Aug 11, 2009
so I have some buttons that, as of right now, simply trigger the scene to move on while at the same time killing some particle effect animations I have spawning when the animation is idle. What I now need to do is make these events move on to a specific scene AFTER the rest of the scene's animation has played out (about 400 more frames) I'm figuring that the gotoAndPlay command has to be tied to some sort of timer variable that I would have to figure out based on my fps. Or maybe there is a way to set up a timer directly tied to a certain amount of frames allowed to go by. I'm pretty noob at actionscript, so keep that in mind. Here is the script at the point where the animation pauses to await user input on the buttons:
[Code]....
View 4 Replies
Jul 28, 2011
Forgive if I am not explaining this very well- here goes. I have one major site with three other gallery sites that are related. From one of the gallery sites I need to create a button that takes you back to a specific page on the major site.
[Code]...
View 7 Replies
Jan 17, 2006
What I want is a hint how to make a specific thing happen while clicking a specific button. Like "if I click button 1, do this". Would like to use this script though I'm gonna add buttons over time and this is an easy way to have the functionality working.
Here's the code:
Attach Code
function hitButton(btn) {
btn.onRollOver = function() {
this.colorTo (0xC4006A);
[Code]....
View 4 Replies
Mar 31, 2006
i need to change the colour of a graphic in a specific movie in a specific frame. if i have a movie clip instance-named "sidetext" thats 15 frames long, and i want a graphic in the movie, called "letterp" to change to one of four colours that i want it to randomly at frame 10 and stay that colour uintil frame 15, how can i do this?
View 2 Replies