ActionScript 2.0 :: How To Get MovieClip To Move With Mouse Direction
Apr 20, 2004How 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 RepliesHow 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 RepliesDoes anyone know the algorithm used in this image panner [URL]
How to move the image in the opposite direction of mouse.
[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.
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.
Is it possible to rotate movieclip, while dragging, according to mouse direction and mouse x, y on that clip.
on the picture the 0, 0 of the mc containing red box is where the lines cross, the mouse point is indicated with cursor and around it is the circle where clip's x and y should be constrained and movieclip should rotate according to mouse movement direction for example: when mouse is moving straight down then the clip's x, y rotates up and stops when its 12 o'clock...
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 RepliesI am about to make a gallery where all the pictures are ligned up, in a vertical row collum.I wan to make the Movieclip move in the opposite direction of my mouse movement
View 2 Replieshave 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?
Okay I have a script in which I have added an image to the stage. It is absolute centered. I then have another with is on top but much bigger. I would like the big image to move opposite of my mouse position on the smaller image. ie: cursor is on bottom left corner the bottom left corner of the larger image is in the same spot. And the same thing for any other area.
I have tried many different ways but to no avail. I have done research but no one has been able to give me a solid answer. Anyone know of a way to accomplish this. Keep in mind this it needs to work regardless of the image size.
I'm doing a game where there are 12 movieclips (cards) on the screen that are draggable. The cards can also be turned around (using 3d rotation).
My client is experiencing problems: Cards sometimes stick to the screen and can't be dragged. Moving the cursor over the card erases it (like negative masking). The game has no features that are even remotely close to this issue.
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 RepliesIm making a horizontal thumbnail-scroller. Thumbnails are loaded in to a MovieClip and placed side-by-side with some spacing.When I move the mouse to the far right of the stage, the last thumbnail is to the far right on the stage, and when I move the mouse to the left, the movieClip.x = 0.
I can do this and have a script ready. BUT: If I would like the first thumb to be at 0 when my mouse is 100px from the left side and the last thumb to be to the far right of the screen when my mouse is 100px from the right side, how would I make this happend?I've spent $30 on scripts from activeden and 5 hours on trying to make this happend, but I just CAN'T find the solution..
Code: Select allfunction moveScrollerThumbs(e:Event):void
{
if (mouseY > box.y && mouseY < box.y +box.height)[code]....
I need to move a movieclip based on mouse x position. Like this site [URL] - Which I built using a flashloaded app, but I need more control in this project so I'd like to code it without the app. Basically, I have an image of a boy (left) and a girl (right) and I want to move the boy slightly toward the girl when the mouse goes right and slightly away when the mouse goes left. But only about 25-50 pixels in each direction.
I've cobbled some code together from google searching and rough ideas, and it works in a way, but the boy jumps about 400 pixels to the left on the initial mouse move and then floats a bit too far right and left from there. Here's what I've got on the boyMC:
[Code]...
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]....
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].....
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 Replieswhat 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 RepliesBasically 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?
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 RepliesI 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].....
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]
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 RepliesI designed a horizontally oriented page that expands to the right. The problem is, the content goes off the screen.
I want to know how to make all of the content on the website scroll with the mouse direction like this webpage- sectionseven.com
Does anybody know how to do this or something similar?
I wanna detect the direction of mouse movement. If the mouse moves tpwards the left or right of its currrent position, i want to detect it. Is there anyway to identify such movement. Actually i am implementing a 360 degree rotation of image. That means , if the mouse moves along the left side of its current position, then the image should move along its left side, otherwise it should move along the right side. For example, view this site:
View 4 RepliesI am horrible at maths and I would like to ask how to make an object ex. an arrow turn into direction of the mouse?ENTER_FRAME and some mathematical functions, but I cant tell which and how to use them.
View 2 RepliesI'm having a problem when detecting the direction of the mouse.I'm using the following script:
Code:
stop();
//
[code].......
I wanna detect the direction of mouse movement. If the mouse moves tpwards the left or right of its currrent position, i want to detect it. Is there anyway to identify such movement. Actually i am implementing a 360 degree rotation of image. That means , if the mouse moves along the left side of its current position, then the image should move along its left side, otherwise it should move along the right side. For example, view this site: [URL]
View 4 RepliesI am trying to create an image pan that's move this image oposite to the mouse position with a tween effect.
There are lots of posts and tutos but I can't make it runs with as3.
I 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;
import flash.ui.Keyboard;
var dist:Number = 0;
[Code] .....
How to make that first ball did not change its direction and continued to fly in the direction of the shot?
so basically I have a circle which I got to spin around and stop when the mouse is over it. However I now need it to also spin Anti-Clockwise if the mouse is near the top of the page and clockwise if the mouse is at the bottom of the page.
Can anyone help? I did the animation through tweening in flash so my code is tiny, but here's what it is. I'm new to flash so forgive me if I don't know what I'm doing.
[Code]...