ActionScript 2.0 :: Movieclip Frame Depending On Mouse Angle?
Sep 21, 2010
so i have a movieclip with this script on it (this makes my movieclip rotates)
ActionScript Code:
onClipEvent(enterFrame){
angle = (Math.atan2(_root._ymouse-_y,_root._xmouse-_x)*180/Math.PI);
[Code]....
Now, i have (let's say) 30 frames inside this movieclip, and i wan't it to change is current frame depending on the angle of the mouse (example, if i point my mouse to the right, the mc goes to frame 30, if i point my mouse a little up, the mc goes to to frame 27, if i point my mouse all to the left the mc goes to frame 15... etc...)
Basically the movieclip should change it's frame depending on the mouse angle,
By the way, i don't really wan't the moviecliip to rotate (like it's doing now) i want it to change it's frame only...)
View 4 Replies
Similar Posts:
Oct 28, 2010
This is a CS4 file so and I have CS5 so if you give me either it will be awesome
I have a movie clip that follows the mouse..
Its not done yet but its gonna be a dog chasing a/the mouse...
I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like
if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left and one for right up down (I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse..
(say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section??? like the equivalent of onRollLeft or whatever.)
this is the code i have.. its the top statement that doesn't work the bottom 2 do..
Code:
if (_xmouse < detail.x+10) {detail.gotoAndPlay(61);
}
detail.onRollOver = function() {
detail.gotoAndPlay(31);
[Code].....
I already created the shapes and placed them in the appropriate frames.. you should only need to mess with the actions on the instance "detail" (the dog face in frame 1 of scene 1 in layer "follower" ---- just the actionscript needed for that instance is needed in the reply.. you should not need to chage any of the layers, but if you do just tell me what you did and why.
my fla is to big to upload to this form so im placing it on my website here
View 2 Replies
Oct 28, 2010
Its not done yet but its gonna be a dog chasing a/the mouse. I want to have it where the if the mouse is left or right of the following movie clip it shows it walking toward the mouse... so something like
if mouse positions is less the the cursor + 10 (pixels) goto and play frame with dog walking left
and one for rightup down(I want this to walk till its directly under or over mouse and then laydown or jump only when over or under mouse.. (say its a 20 pixel wide object and 10 on each side will cover the whole thing and not just the exact center pixel, thats what the 10 + movie clip position is for, but Is there a way to tell it to goto and play whatever_frame when mouse is left of any graphic on the sitting dog section???like the equivalent of onRollLeft or whatever.)
[Code]...
View 3 Replies
Aug 12, 2010
I'm attaching the file so that you guys can see that? pretty basic. My main problem is to find out how can the mouse check the mouse position on stage and make the coverflow animate and the movieclip change angle depending on the side, I have to animate only 5 itens, here?s the AS:
[Code]....
View 8 Replies
Mar 1, 2011
I am currently developing a game in a school project using Flash CS4 and Actionscript 3.0. I have searched the web for assistance, but have come up empty. Here is what I am wanting to do...
I have a 3 by 3 grid on screen. Each block in the grid contains a movie clip with four targets which cycle through at 24 fps. Each target with have a different outcome depending on which frame the mouse is clicked.I do not want the animation to stop after the frame is clicked, however. There are several different types of targets in the game. Some add points, some subtract points, one target has the avility to freeze the animations for a set period, and another one is basically an instant game over. Being as how I could not find any aid via the web prior to this post, I am not even positive that this is possible to code in AS3.0.Does anyone know if this is possible, and if so, how would I go about coding it?
View 2 Replies
Aug 31, 2009
Essentially I'm just trying to rotate an object (mc) clockwise or anticlockwise depending on the value of a variable called 'angle'.If 'angle' is positive it should go anticlockwise.If 'angle' is negative it should go clockwise.
Option 1
PHP Code:
if(angle > 0) {
mc.rotation += rotateIncrement;
}
[code]....
View 3 Replies
Mar 11, 2011
Code:
knob_mc.addEventListener(MouseEvent.MOUSE_DOWN,turn);
stage.addEventListener(MouseEvent.MOUSE_UP,endTurn );
function turn(e:Event):void[code].....
This is the code I'm using to move a knob the challenge is when i click on the knob it turns 90 either left or right depending where i click, I'd like it to stay still until I turn the knob, and second how do I get the angle in whole numbers??
View 3 Replies
Oct 9, 2007
I have recently followed a tutorial to make a movieclip in flash that makes buttons spin around a point depending on the mouse position. I have made my own version off this and would like to use it in a full flash website that i am making at the moment.
The only problem that i am having is with aligning this clip and as it is made up of script i cant physicly drag it to were i want it. I understand how to alighn this with x/y positioning but when i preview the flash in a web browser it is positioned correctly but then when i 'full screen' the browser this clip jumps about 4 inches down the page.
View 1 Replies
Jan 12, 2011
I am creating mouse scroller and when I insert actionscript my images wont move depending on the mouse movements..I am using Flash cs5 and Actionscript 2.0...this is my actionscript:
[Code]...
View 9 Replies
Mar 4, 2009
i've not tried to do anything odd with eventListeners up until now. i have a movieclip with multiple frames that i use AS to attach a textfield to it. problem is i have a eventlistener for when the mouse rollsover the movieclip to go to frame 3 of the movieclip.
[Code]...
what's causing the textfield to suddenly take precedence and how do i stop it. when i trace the evt.target - it is my movieclip.
View 5 Replies
Jul 1, 2011
i have a movie clip that follows my mouse to create a fading line.the thing is that i want that movie clip to change its angle according to the mouse movement.Right now the mocie clip is kind of changing its orientation but it's also gettin cray and is not fluent.heres the code of the part that draws the mouse
private function drawMouseLine(e:MouseEvent):void[code].........
View 3 Replies
Apr 18, 2009
how to get angle of mouse its very simple.use this Script (copy and past in your file). A sample file which runs only on CS4 is attached.
//Start............................................. .................................................. .................
// Make a line (o-----------------------) and take its left side as center named 'mcArrow'
mcArrow._x = mcArrow._y =200;
[code]....
View 1 Replies
Jun 24, 2003
ok so i have been trying to detect the mouse angle.. kinda figuring it out on my own to learn new stuff and get a better understanding of actionscript, but ive kinda run into a problem i cant figure out.ere is the range of angles i get
Code:
0
|
[code]....
View 2 Replies
May 4, 2011
I can't work out how to do this, but this is what I have so far..
onClipEvent (enterFrame) {
radians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
degrees = (radians/Math.PI)*180;
_rotation = degrees;
}
How would I make it so that it can only point between 0 and 90 degrees?
View 3 Replies
Oct 13, 2008
What code would I apply to a movie clip to make it rotate on one end according to the angle (location) of the mouse.
View 6 Replies
Sep 17, 2011
I have a circle with 8 dots around the edge of it. Based on the center of the circle and the mouse's location, I want the dot that the mouse is closest to, to get bigger. I've got this so far ActionScript Code: angle = Math.atan2(rt.mouseY - y, rt.mouseX - x); But I'm getting some weird quadrant values returned that are between -3 and 3. Is there a way to know which degree out of a 360 circle my mouse is at in regards to the center of the circle?
View 4 Replies
Jun 9, 2011
How to keep a MC a certain distance from the mouse cursor regardless of angle?
View 10 Replies
Feb 1, 2010
How can I calculate the angle of a 3d object based on the mouse speed?I want to change the rotationZ state based on the mouse position.
View 0 Replies
Jun 15, 2011
I want to make a counter get higher depending on mouse speed.
Code:
mousespeedy = _ymouse - oldymouse;
oldymouse = _ymouse;
posmousespeedy = Math.abs(mousespeedy / 100);
[Code].....
View 1 Replies
Mar 13, 2009
URL...Not too sure how to name this issue so its hard for me to search for such a tutorial..
View 1 Replies
Jan 4, 2009
Ok, so I'm making a Myst-type game as a simple first application, and one of the things I need this to do is not have the arrow change to a finger when over a manipulable object. How do I either tell the program to change a certain cursor to another in a given context, or to keep it at default even in situations where
it would not be so (over a link, etc)?
This is probably a step beyond the questions I've asked so far in complexity but I'm sure you gurus are up to it. :)
View 3 Replies
Jun 8, 2004
I know this can't be to hard too achieve, but my actionscript skills aren't quite up to it yet.
- I have 5 frames within a MC.
- In this MC there is text saying "center", "left", "right", "up", "down" on each frame.
- All I want to be able to do is make the MC change to frame 3 "right" when my mouse moves to the right of the MC.
I know the script below is wrong, but would it go something like, this. Would I have to use angle and math or is there a simpler way to achieve this?
onClipEvent (mouseMove)
get x position
get y position[code]......
View 1 Replies
Jun 22, 2005
I'm looking to a menu that scrolls vertically depending on the mouse position.I know that voetsjoeba has a cool scroller that does this, but loads XML and such. I'm just looking to scroll an MC up and down with easing depending on the mouse position.I like the way that the new XML thumbnail gallery that Kirupa put up scolls along the bottom, how about something like that?
View 4 Replies
Oct 6, 2009
I have a button symbol on my stage that I want to change size depending on where the mouse is on stage. ie: the y position of the mouse will make the x and y scale change (the symbol should get smaller as the mouse moves up the page and larger as it moves down - as if it is getting closer or further away).
View 1 Replies
Jun 8, 2004
I know this can't be to hard too achieve, but my actionscript skills aren't quite up to it yet.
- I have 5 frames within a MC.
- In this MC there is text saying "center", "left", "right", "up", "down" on each frame.
- All I want to be able to do is make the MC change to frame 3 "right" when my mouse moves to the right of the MC.
onClipEvent (mouseMove)
get x position
get y position
if statement x= > -180 and y=> 0 (something like that)
_root.myMovieClip.gotoAndStop(3)
View 1 Replies
Sep 23, 2009
Does anyone know the code for finding the global positioning of X & Y co-ordinates of a click of a button which is constantly rotating, and then secondly the code for when you click on the button it displays a movie clip on top of it -(position of x & y when clicked) at the angle that you clicked it,so underneath the buttons are still rotating so other people can click them where they are?
to explain the context, I'm trying to design a mock up of a circular interactive table Dynamically placing movie clip at the angle and global position of a mouse click (button) which is constantly rotating.when someone comes up to it and clicks on one of the buttons that are moving, it reads where the person clicked it and opens up a new box (movie clip) where they clicked it (at the angle) so its not upside down if you are at the top.
I've included my .fla file which shows the four buttons moving and a little diagram explaining what I'm trying to do.
View 3 Replies
Sep 23, 2009
Does anyone know the code for finding the global positioning of X & Y co-ordinates of a click of a button which is constantly rotating, and then secondly the code for when you click on the button it displays a movie clip on top of it -(position of x & y when clicked) at the angle that you clicked it, so underneath the buttons are still rotating so other people can click them where they are?
I'm trying to design a mock up of a circular interactive table when someone comes up to it and clicks on one of the buttons that are moving, it reads where the person clicked it and opens up a new box (movie clip) where they clicked it (at the angle) so its not upside down if you are at the top.
I've included my .fla file which shows the four buttons moving and a little diagram
explaining what I'm trying to do.
View 1 Replies
Mar 25, 2009
I am having problems with this if else statement. I have a variable (frame number 30) passing into my swf from another swf. This I know is working correctly.
But - I need to be able to direct to different frame numbers depending on the variable, this is working.
But when I place this code:
[Code]...
View 2 Replies
Apr 28, 2004
I have set the variable in my page using <param name="flashvars" value="menustate=<?php $pagename; ?>"> which works perfectly fine when I use a dynamic textbox in flash with the var name menustate.
But I need to send a MC to frame 2 if 'menustate = 2'. Anyhow, I just want to know how to control a MC with an external var. I can't use loadVars () because this var is coming from any page, not just one.
View 5 Replies
Nov 29, 2011
Quite simply I need a piece of code which jumps to a certain frame based on the actual dates below.
1-4rd Dec - gotoAndStop(1);
5th Dec - gotoAndStop(2);
6-7th Dec - gotoAndStop(3);
8th Dec - gotoAndStop(4);
I have found bits of code which allows you to specify which days, but not dates. My actionscript is very beginner so I can't work out what to do.
View 2 Replies