Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash








Movie Clip Rotation To Follow Mouse


Hey,

First off, lemme start by saying that this site is incredibly awesome. Every time I have a problem or wish to learn something in Flash I turn to kirupa.com. Thanks a lot!

Now for my problem. Have you ever played Madness? You know how, depending on where the mouse is, the hand rotates i.e. points at the mouse's current position? Well, I want to learn how to do that. I've attached a short animation demonstrating what I want to be able to do (the arrow points at the mouse's position, and then gun represents the movie clip that rotates) using a script provided by the kind soul who will be willing to help me.

Thanks again,
-Raven~Storm




KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 08-16-2005, 08:36 PM


View Complete Forum Thread with Replies

Sponsored Links:

Rotation On Movie Clip, Follow Mouse
I am creating a game where I have a turret (a movie clip) on a helicopter (also a movie clip) , and the helicopter has action scripting to move with the W, A, S, and D keys, and the custom cursor is crosshairs. I want the turret to follow the mouse with rotation only, and follow the mouse whether the mouse is moved and the helicopter isn't, or whether the helicpter is moved and the mouse isn't, or if both are. I am using MX and I would appreciate any help. I have searched the tutorials. Thanks for your time.

View Replies !    View Related
Movie Clip Follow Mouse
What do i need to do to have a movie clip follow my mouse around the stage? Thanks

View Replies !    View Related
Making A Movie Clip Follow The Mouse
how do you make a movie clip follow the mouse horizontally only when the mouse goes over a certain area of the stage instead of the whole movie?
I have buttons that I would like a line to follow the mouse when it goes over them.

Thanks!

stacey

View Replies !    View Related
On Rollover, Movie Clip Appear And Follow Mouse?
Can anyone help me with this. I want a movie clip (specifically, some text in the form of a MC) to appear and follow the mouse when it rolls over a specific area and dissapear on rollout. can anyone help?? thanks!!

View Replies !    View Related
Movie Clip Pivots To Follow Mouse
Hello group-
I am new to posting, so here goes: I am trying to have a slingshot follow the mouse from a pivot point: that is, have it rotate from its registration point, not follow the mouse around the stage, or have 36o-degree rotation. The mouse will pass over an invisible button, which, on press, will go to and play an animation in a different scene, of a rock zooming to the target. This in turn will go to and play another animation in a different scene. I have a very basic understanding of Actionscript, and I am working in Flash MX (my school won't upgrade).

Thanks in advance!

View Replies !    View Related
Making A Movie Clip Follow The Mouse
I have a movie clip following the mouse. I just need to know the name of the function that makes flash redraw instantly instead of at the end of the function.

in director this function is called updateStage()

Example:

function gameLoop(){

clip1._x = _xmouse;
clip1._y = _ymouse;
updateStage(); //redraw

// other statements
// other statements
// other statements
// other statements
// other statements

}

View Replies !    View Related
3D Movie Clip Follow Mouse Problem
Hi. I am an actionscript beginner and wondering if you can help me? I would REALLY appreciate your help with this.

I made spiral rotating line in 3D space animation using Flash CS4. I would like for my 3D spiral Movie clip to follow the mouse movements of a visitor.

My code works.....but....the spiral decreases in size and eventually disappears when moved to certain sections.

In short, what I am trying to do is to keep my spiral effect constantly the same size and movable on the screen.

Here is the code

addEventListener(Event.ENTER_FRAME, rotate3D);

function rotate3D(e:Event):void
{
spiral02_mc.rotationX += 1;
spiral02_mc.rotationY += 2;
spiral02_mc.rotationZ += 3;
}

spiral02_mc.addEventListener(MouseEvent.MOUSE_OVER , pressHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, releaseHandler);
function pressHandler(event:MouseEvent):void {
spiral02_mc.startDrag();
}
function releaseHandler(event:MouseEvent):void {
spiral02_mc.stopDrag();
}

View Replies !    View Related
Help-Movie Clip Will Follow The Mouse Movement
Hi everyone,
I'm neither a beginner nor a pro in AS. Would u pls help me in this issue-this is very imp and urgent.

Pls visit http://www.mindengine.com/ This is a cool site. I want to replicate the movement of it-only the initial part where user moves his mouse and the whole screen moves. I need this part to replicate.

Can u help me, pls, pls...

Thanks.

View Replies !    View Related
Follow The Mouse+movie Clip Roll Over
Hello, I'm trying to make a movie clip following the mouse when I roll over to another movie clip. I'm trying this code but it does not seems to be working:
Code:

_root.moshe.onLoad = function() {
   this._x = 0;
   this._y = 0;
   speed = 5;   
}

boxer.onRollOver = function() {
   _root.orn1.gotoAndPlay(2);
   _root.moshe.onEnterFrame = function() {
   endX = _root._xmouse;
   endY = _root._ymouse;
   this._x += (endX-this._x) / speed;
   this._y += (endY-this._y) / speed;
   }
};

Any suggestions would be greatly appreciated, thanks.

View Replies !    View Related
Mouse Follow Rotation Limits
I'm currently working on a game where I have a movieclip that rotates based on _xmouse.
__________________________________________________ _________________________

Code:
this.onEnterFrame = function() {
//Mouse
__________________________________;
Mouse.hide();
__________________________________;
this.shooter._rotation = 0;
this._xmouse = 100
if (this.shooter._rotation>-90 & this.shooter._rotation<90) {
this.shooter._rotation += _root._xmouse/2;
} else if (this.shooter._rotation<-90 & this.shooter._rotation>90) {
this.shooter._rotation = _root._xmouse/2;
}
};
__________________________________________________ _________________________

mouse this allows the rotation to follow the mouse, but I can't figure out how to set limitations for it. The min value should be -90 and the max should be 90.

Thanks for those who help me.

View Replies !    View Related
Mouse Follow Rotation With Ease
I'm using the basic mouse follow technique i stole from some tutorial, yes i understand it, but im in a rush

I'm trying to make it ease to the spot but it doens't seem like there is a way.

It is jumpy, i would like to it to slowly smooth to the current mouse location. It's going to be used for a touch screen


Heres my current AS:

ActionScript Code:
stop()face.onRollOver = function(){startDrag("mouseTarget", true);onMouseMove = function(){mouse_x = mouseTarget._x;mouse_y = mouseTarget._y;xDistance = mouseTarget._x - face._x;yDistance = mouseTarget._y - face._y;// set the normalisation factorif (Number(xDistance)<0) {    normalise = -1 * xDistance;} else {    normalise = xDistance;}if (Number(yDistance)<0) {    normalise = Number(normalise)+Number((-1 * yDistance));} else {    normalise = Number(normalise)+Number(yDistance);}// determine the directionif ((Number(xDistance)>=0) and (Number(yDistance)>=0)) {    direction = 90*(yDistance/normalise);} else if ((Number(xDistance)<=0) and (Number(yDistance)>=0)) {    direction = Number(-1*90*(xDistance/normalise))+90;} else if ((Number(xDistance)<=0) and (Number(yDistance)<=0)) {    direction = Number(-1*90*(yDistance/normalise))+180;} else {    direction = Number(90*(xDistance/normalise))+270;}// set direction of needle and bulletneedle._rotation = direction;}}face.onRollOut = function(){    mouseTarget.stopDrag();}


Heres a link to the current SWF:
http://www.joshuajonah.com/compass.swf


Heres a link to the current SFLA:
http://www.joshuajonah.com/compass.fla

View Replies !    View Related
Detect Mouse _x & _y Attach Specific Clip And Have It Follow Mouse
I'm trying to make a clip that will have another clip attached (eventually it'll be a mask) when you roll over it. I want the mouse positon to be determined on rollover and a different clip (with different registration point) to be attached depending on which quadrant you rollover first. IE- you rollover the lower left quadrant of the mc first so an mc with an upper right registration point is attached and follows the mouse.

basically I want it to look like you're pulling a mask from out of nowhere onto the main mc from whatever corner you start on... (make sense?)

i'm trying to reconstruct what you see here (http://www.mullerphoto.com/)
this is the first baby step!

anyhow, here's my AS and i'll attach the .fla any help is great! I have the actionscript dictionary and am not afraid to use it, I just need help with the mechanics of how to actually do this (i.e.- which methods, properties, etc. to utilize) thanks!


Code:
leftfunction = function(){
if (patch._ymouse <= 100){
llowerfunction;
}else{
//this function starts the maskclip coming in from the upper left with a lower right reg point
_root.patch.attachMovie("lowerright", "lrclip", 1);
lrclip._x = _root.patch._xmouse;
lrclip._y = _root.patch._ymouse;
}
}

llowerfunction = function(){
//this function starts the maskclip coming in from the lower left with an upper right reg point
patch.attachMovie("upperright", "urclip", 1);
urclip._x = patch._xmouse;
urclip._y = patch._ymouse;
}

rightfunction = function(){
if (patch._ymouse <= 100){
rlowerfunction;
}else{
//this function starts the maskclip coming in from the upper right with a lower left reg point
patch.attachMovie("lowerleft", "llclip", 1);
llclip._x = patch._xmouse;
llclip._y = patch._ymouse;
}
}

rlowerfunction = function(){
//this function starts the maskclip coming in from the lower right with an upper left reg point
patch.attachMovie("upperleft", "ulclip", 1);
ulclip._x = patch._xmouse;
ulclip._y = patch._ymouse;
}

_root.patch.onRollOver = function() {
if (patch._xmouse <= 150){
leftfunction;
}else{
rightfunction;
}}

View Replies !    View Related
Moive Clip To Follow Mouse
I would like a movie clip to follow the mouse along its horizontal position.

I am using this code:

onClipEvent (enterFrame) {
setProperty (this, _x, _xmouse);
}

but it causes the movie clip to flash and not follow the cursor tightly.

Is there a better way?

View Replies !    View Related
Can I Constrain A 'follow Mouse' Clip To Certain Areas Of The Screen?
Hi there

got a clip that follows mouse on the Y axis ...

As it stands, the clip is active and follows the mouse up and down the WHOLE screen

Would like to set it up, so that it only follows between about an inch or two of the screen

Here is the code ive used to set up the mouse follow

//y movement

my9=_root.content._ymouse;
if (my9<_y) {
dy9=_y-my9;
}
else {
dy9=my9-_y;
}

moveSpeedy9=dy9/5;
if (my9<_y) {
_y=_y-moveSpeedy9;
}
else {
_y=_y+moveSpeedy9;
}

//x movement

mx9= 300;

moveSpeedx9=dx9/10;
if (mx9<_x) {
_x=_x-moveSpeedx9;
}
else {
_x=_x+moveSpeedx9;
}
}

X movement not important, just want the clip to follow when the mouse is somewhere between 150px and 350px from the top of screen

Could really use some help here ... any ideas?

Cheers for any time and suggestions you can give

G

View Replies !    View Related
[F8] Make Textmovie Clip Follow The Mouse Cursor
Hello
How can I, on roll over, make a smallsimple movie clip just with some text on it follow the mouse cursor while it is over the area selected?
Thanks, cumps

View Replies !    View Related
[F8] Make Textmovie Clip Follow The Mouse Cursor
Hello
How can I, on roll over, make a smallsimple movie clip just with some text on it follow the mouse cursor while it is over the area selected?
Thanks, cumps

View Replies !    View Related
Follow Mouse Outside Movie
Hey guys

Is it possible if I have a movie on my page and a movie clip inside, to get the movie clip to follow the mouse position left and right when the mouse is anywhere on the page (not just over the movie) ??

If so how ??

thanks

View Replies !    View Related
Movie Follow The Mouse
Hi mates
i m making a site and want its movieclip to follow the mouse (left,right,up,down to the end of the picture i masked and had put in the mc)i used most of the codes here on the forums but all it does is it moves fine but the whole pic inside the movie clip dissapear and the background color appears i want it to stop at the end of the pic in the mc (to stop at the left,right ends of the image i use as mc)

i know it may be a stupid question and i didn't explain it well but here is what i mean and want to do

http://www.fifastreet.com/

please take a look and tell me

Cheers

View Replies !    View Related
Attached Movie Mouse Follow
quick question...


i have attached a movie to the stage like this....

code:
_root.attachMovie("Circle", "xLargeC", 3501);
xLargeC._x = 37.5;
xLargeC._y = 85.0;
xLargeC._width = 18;
xLargeC._height = 18;
_root.attachMovie("Circle", "yLargeC", 3502);
yLargeC._x = 13.6;
yLargeC._y = 110.1;
yLargeC._width = 18;
yLargeC._height = 18;


now i want the xLargeC to follow my mouse movement on a horizonal path... and the yLargeC to follow on a vertical path? make sense? if i move my mouse up the yLargeC moves up too but never left or right??? so i just need some type of way to write the AS on this...

Thanks,
Carlos

View Replies !    View Related
Mouse Follow But With Movie Anchored?
How do I get my 'mouse follow' action to work whilst the actioned movie clip is anchored to one point? ie: an eye in the head of a stationary character - the pupil watches what you are doing, following the mouse but not leaving the charcters head?

View Replies !    View Related
Duplicated Movie Clips To Follow Mouse
Hi all,

I have a simple movie clip (a circle) duplicated 10 times using the following actionscript.

n=0;
while (n<10) {
duplicateMovieClip ("_root.circle", "mc"+n, n+1);
setProperty ("mc"+n, _xscale, n*10);
setProperty ("mc"+n, _yscale, n*10);
n=n+1;
}

How do I get each movie clip to follow the mouse on the X axis only?

naes

View Replies !    View Related
How Do I Make A Flash Movie Follow The Mouse
Ok. I want to have somethign going left to right be followed by the mouse, and i wana have it masking my sites name. I know the masking i made what it looks like but how do i get JUST the mask to follow it? plz help me

View Replies !    View Related
Crit Movie And Very Advanced Mouse Follow?
Hi guys!

Firstly it would be nice of you to crit my freelance cartoon website...

http://uk.geocities.com/tris3d@btinternet.com/main.swf

... I know this isn't the place to post but the main reason i'm here is help! The movie is very rough and is 900kb's without preloader so sorry about that.

Anyway, I spent ages creating this site ( lack of programming knowledge ) and now that i finally came close to finishing I think its to messy for a cartoonist site.

Now i've got an idea for a more simplistic version but the only thing standing in my way is the code for a very advanced mouse follow.

http://www.kirupa.com/developer/mx/mousetrailer.htm

Funny enough its not that much different from the above effect except i really want to have a mechanical arm instead of text and imagine in that tutorial that the last letter was contrained to something.

Just to complicate things i wanted the hand to be able to point in the direction that the mouse follows with smooth animation so it doesn't just have the four directions. Is any of this possible? Would love any help or at least someone to tell me its not possible to stop my excitement for the new look freelance web site.

This has been a superb forum for helping people like me that have ideas but will always have programming barriers.

Thanks in advance for any help.

View Replies !    View Related
Mouse Follow But With Movie Anchored? Solution Found
Found the code on this site - It only needs 2 lines of code deleted and your ready to rock.

http://www.actionscript.org/tutorial...se/index.shtml

If you want the movie to chase after the mouse leave this code as it is at the above url, if you want to anchor it to it's staring point then use this:

onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
_root.yMove = Math.round(_root.yChange/20);
_root.xMove = Math.round(_root.xChange/20);

this._rotation = myDegrees+90;
}

View Replies !    View Related
A Movie Clip Follow Another?
I had used motion tween to move the first movie clip, now the problem is, I need to make another separate movie clip to follow the first movie clip when it was moving in a motion tween, is there any ways to do that? Pls help..

Thanks

View Replies !    View Related
Follow Movie Clip
hi
i have a movie clip that moves using _x, i want to know how i can have another movie clip follow it.

View Replies !    View Related
Follow Movie Clip
I have a forklift which can do anything (raise lower fork, and move forward or backward) and I have a object that I want the people to have to lift. I figured it would be a hitTest but i dont know. What I need done is when the fork ("Tyne") hits the object ("op_hit") the object follows the fork wherever it goes.

I tried this code but it did not work:

onClipEvent(enterFrame) {
if(this.hitTest(this._parent._parent.myFork.mast.T yne)) {
setProperty(this._parent, _x, Number(getProperty("/myFork/mast/Tyne", _x))+20);
}
}

Thanks in advance for help.

View Replies !    View Related
Follow Movie Clip
How do I make a movie clip follow another movie clip? Kinda the way I can make things follow the mouse pointer? I have no idea how to write the code ....will somebody help ?

View Replies !    View Related
Follow Movie Clip
How do I make a movie clip follow another movie clip? Kinda the way I can make things follow the mouse pointer? I have no idea how to write the code ....will somebody help ?

View Replies !    View Related
Movie Clip Follow
how do I get one movie clip to follow another?

Thanks

View Replies !    View Related
Follow A Movie Clip?
How do I make it so that a movie clip follows another movie clip?

View Replies !    View Related
Getting One Movie Clip To Follow Another DYNAMICALLY
Ok, I'm trying to create some circles (or balls, whatever) that connect to a line and "stick" to the line, no matter where the line might move...like a strand of pearls. So, if the first "ball" moves up, the entire line of balls will follow suit.

Sort of like a mouse trailer, but not on a mouse. Just a free-standing Movie Clip that I can use again and again.

I'm using MX.

Thoughts?

Thanks!

View Replies !    View Related
Make One Movie Clip Follow Another? HELP
Okay. Here is the scenario. I have a movie clip that you can click and drag. (its a mask by they way). I want to put a border around the mask though without the border becoming part of the mask. Im sure there is a better way to do this but I'm running out of time. Someone told me I could make the border its own movie clip and put actionscript to it onEnterFrame so it's position is always the same as the position of my draggable clip. In essence im dragging one clip but another one is going along for the ride as well at the same exact position. I just dont know the syntax to do this.

Attatched to my draggable clip is:

on(press) {
startDrag(this,false);
}
on(release) {
stopDrag();
}

I just want a secong movie clip go wherever this one above gets dragged.

Thanks in advance.

Ari.

View Replies !    View Related
How Do I Make A Movie Clip Follow Another Mc?
hi ppl,
I am trying to make a movie clip follow another movie clip.

I have llokewd everywhere, but all i can find is how to make a movie clip follow the mouse. Im trying to find some code so that a movie clip will follow another movie clip.

thanks in advance

View Replies !    View Related
[F8] Getting A Movie Clip To Follow A Path Around Another One
how does one make a move clip follow a specific path around another one? i have been trying for the past like 3 hours and i can't figure it out. if i have a square and another movieclip, and i want the movieclip to "roll" around the edges of the square, how can i do it?
if you can, please help me!

View Replies !    View Related
Attaching A Movie Clip To Follow Another...
Hi Guys,

Anyone remember the centipede game? I have a similar situation where after you eat a bug it is supposed to attatch to your body in a different form and follow you around.

I've got the Flash 8 AS bible but this is like looking for a needle in a haystack. Can anyone tell me where to start with an AS function? Or even which AS to use as I don't think attachmovie will do it...

Cheers

View Replies !    View Related
How Could I Get An Arrow To Follow A Movie Clip?
Is there anyway to make an arrow point to a moving movie clip, besides moving the arrow every frame?

View Replies !    View Related
How Can I Have A Movie-clip/graphic Follow A Path?
Let's say I draw a nice curved path (with a decent width) and I want movie clips to follow the curve path (inside of the path, in the middle).

How would I do this?

Thanks,
John

View Replies !    View Related
[F8]How Do You Make A Movie Clip Follow A Object?
How do you make a movie clip follow an object? I have no clue.

View Replies !    View Related
Making The Stage Follow A Movie Clip?
Hey crew. Im new. Hi! xD Having a wee trouble with this semi platformer im trying to make.. Anyone got an idea how to make rest of my screen move with my character?

Like.. i dont want screen till move until oliver gets close to the edge.. then screen goes with him.. the camera.. yknow? just like in super mario or something ^_^

...HELP!

Thanks xD

View Replies !    View Related
Menu/movie Clip...image Follow
at this site on the right hand site... there are 3 menu options...with one white box that follows where your curror goes. i can acomplish this but the movie i make snaps the white bow back to the top...anyone know how this is done????? http://www.blitzds.com/relaunch.html thanks for the help

View Replies !    View Related
Menu/movie Clip...image Follow
at this site on the right hand site... there are 3 menu options...with one white box that follows where your curror goes. i can acomplish this but the movie i make snaps the white bow back to the top...anyone know how this is done????? http://www.blitzds.com/relaunch.html thanks for the help

View Replies !    View Related
Rotation Of Movie Clip
I have this movie clip that comes onto the stage after I click a button. I tried to edit it and make it rotate ect.
But when I go to tween it or do any editing it shifts some in the animation. When I go in the time line of the movie clip and make the motio ntween I see two cross hairs where the graphic is and they are not lined up. What is doing this?

Mark

View Replies !    View Related
Movie Clip Rotation
Hello All,

I am sending the file in question as an attachment. I am trying to get the selected movie clip to rotate. But I can't get it to do it. If on the other hand, I provide the name of a static movie clip, like the square- the alpha and size properties can be changed. Can someone please help. Require urgently.

Thanks,
Shilpi

View Replies !    View Related
Rotation Of A Movie Clip
hi,

I'm trying to rotate a circular mc to the 3 o'clock position by clicking the mc at various points e.g if I click it at the 9 o'clock position I'd like it to rotate 180 degrees and stop at the 3'oclock position. The circular mc contains nested mc's - so each clickable item is an mc within the circle.

Can anyone shed any light on this?

Thanks

View Replies !    View Related
Rotation Of Movie Clip
hi

i put the .fla so you guys understand better.
as you see the movie clip shark (the green shape) faces the cursor.
i want it to face the right of the screen but when the mouse is over him, he looks up and when the mouse is under him it looks a bit down.
i want that when the mouse is a lot over him he looks a lot up and when the mouse is just over him he looks just a bit up.

thanks for replies

View Replies !    View Related
Movie Clip Rotation
I have a movie clip, "topBox1", and a button, "News", which are both on the _root. When I press the News button, I want the topBox1 mc to flip horizontally so that the right hand side comes over the left hand side and then stops.

I was wondering if anyone had some tips on what actionscript methods I should check out to accomplish this.

Thank You

Bigek72

View Replies !    View Related
[F9] Making A Movie-Clip Follow A Path (Pathfinding)
Hi,
I've been working on an A* based path finding game.
I can work out a path and all that using a*, but my question is; how do i make a movie clip follow this path from start to finish instead of just drawing out the best path.

My first thoughts are to create an array of the paths points and use that, but i'm unsure of how

any help would be great


jack

View Replies !    View Related
Having A Movie Clip Follow Another Symbol Twitch Glitch
Alright, I'm having a problem with my interactive thing. There's a twitch when this thing follows the other movie clip. Here, look-
http://img.photobucket.com/albums/v4...efka/Chase.swf

This is the action script I have for the thing that chases(the thing being chased has the instance name of chasee)-


ActionScript Code:
onClipEvent(load){
speed=4
}
onClipEvent(enterFrame){
if(_root.chasee._x > _x){
_x += speed
}else if(_root.chasee._x < _x){
_x -=speed
}else if(_root.chasee._x == _x){
_x +=0
}
if(_root.chasee._y > _y){
_y+=speed
}else if(_root.chasee._y < _y){
_y -= speed
}else if(_root.chasee._y == _y){
_y +=0
}
}

View Replies !    View Related
Dynamic Movie Clip Rotation
ok, say i have a movie clip of a logo of some sort, and i have a bunch of buttons
now
when the person hovers over the button, it pops up and a little line is drawn to the movie clip (might be hard to visualize)
now say there is a point on the movie clip, like this > and the lines that come from the buttons get higher and higher, so

logo
|-------| ----------- line that will appear when button hovered
|-------| -----------
|-------| -----------
|-------|> -----------
|-------| -----------

ok, so say i want the logo to rotate correctly, so that the arrow is touching the line (or almost, the logo is actually a circle)
i can't just have the logo rotate in one frame, i want it to animate, but i want it to be dynamic (it can go from any button to any other button) without making tons of labels in the movie clip (ie. one for going from button one to two, button one to three, etc)

does this make sense?
can anyone tell me how to have it rotate(and show the animation) to each of the lines?

View Replies !    View Related
Movie Clip Rotation On Enterframe Help
need help to make a navigation rotate and stop on mouse over???

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved