Actionscript 3 :: Gradually Limit Rotation Of An Object Influenced By Y Position Of Mouse

Nov 23, 2009

I have created a flash app in which there is a circle with circles plotted along it's circumference, it is rotated when the mouse is moved up or down. The rotation is drawn directly from the y position of the mouse pointer. What I would like to do is grade the movement some how so that the further down the mouse pointer goes the less impact on rotation the movement has.

My current code is like this:

myCircle.rotationZ = e.localY;

Is there some form of math formula I could use which would reduce the amount of rotation the greater the y position of the mouse position?

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Rotation Speed On Mouse Position?

Sep 30, 2009

I have a circle wheel i want to rotate and the speed should be based on the mouse position. I also need to have easing in and out.

When the user hovers over the bottom of the circle it will begin to rotate one way and then th top of the circle would make it rotate the other way. The further to the top or bottom they are the quick it spins. It ideally needs to ease in and out when it starts and stops when the user moves the mouse away.

The circle will be the complete movie so 50% top and bottom each for each direction.

View 1 Replies

Actionscript 3.0 :: Start Rotation At Mouse Position?

May 8, 2009

I'm trying to make a movieclip rotate around it's center (this is no problem since the center will never change). The problem that I am having is when I press the movieclip, in let's say the bottomright corner, and move the mouse the movieclip flips to a certain angle depending on my mouseposition. After the weird flip it works fine but it's the initial mouse click that makes the movieclip flip to an angle.I've tried playing around with different values to substract or add the starting angle but eveytime the result is not what i am looking for.Current code:

Code: Select all
package 
{

[code].....

View 8 Replies

Flash :: Ease Rotation And Position Of MovieClip To Mouse?

Jun 25, 2010

Essentially what I'm trying to do is nearly the same as this: http:[url].......However I'd like to ease/tween the movieclip position and rotation to the mouse position.The main issue I see is trying to get the current movieclip rotation and the target rotation,then tween it cockwise or counterclockwise from current to target.The way a movieclips rotation uses positive and negative numbers throws it off.If you just want to lock the mc rotation to the mouse rotation its fine, but once you try to tween it you run into difficulties. So the end effect would be like if you were to draw imaginary clockwise circles around the object, it should just keep rotating clockwise towards the mouse. Then if you started going counter clockwise it should just keep easing counter clockwise to the mouse.

View 1 Replies

IDE :: Ball - Globe Rotation Based On Mouse Position

Nov 30, 2009

I have created a globe that rotates with no problem, but what I am trying to do is to control the direction of the rotation based on the mouse position. For example, if the mouse is to the right of the globe, it rotates towards the right and if the mouse in on the left, the globe rotates left. When the mouse is over the globe, it should stop.

View 1 Replies

ActionScript 3.0 :: Ease Rotation And Position Of MovieClip To Mouse

Jun 25, 2010

I'd like to ease/tween the movieclip position and rotation to the mouse position.The main issue I see is trying to get the current movieclip rotation and the target rotation, then tween it cockwise or counterclockwise from current to target. The way a movieclips rotation uses positive and negative numbers throws it off. If you just want to lock the mc rotation to the mouse rotation its fine, but once you try to tween it you run into difficulties. So the end effect im looking for would be like if you were to draw imaginary clockwise circles around the object, it should just keep rotating clockwise towards the mouse. Then if you started going counter clockwise it should just keep easing counter clockwise to the mouse.

View 3 Replies

ActionScript 3.0 :: Changing An Objects Diameter Of Rotation Dependant On Position Of Mouse?

Nov 16, 2009

I want the diameter of the 'balls' orbit to change dependant on the position of the mouse but keep the point of rotation exactly the middle of the stage at all times.I.e. if the mouse is hovering over the exact center (both X+Y) of the stage then the 'ball' should have a tiny diameter of rotation (but contstantly follows the orbit in clockwise direction) whilst if you move the mouse towards the edge of the stage then the diameter of the orbit of the ball will increase.Here is the AS which controls a blank movieclip;

var sp:Sprite = new Sprite();
orb1.addChild(sp)
var g: Graphics =sp.graphics

[code]....

View 1 Replies

ActionScript 3.0 :: Change A Objects Diameter Of Rotation Dependant On Position Of Mouse?

Nov 16, 2009

This is for a personal art project, however I have hit a potential (Actionscript) brick wall! I want the diameter of the 'balls' orbit to change dependant on the position of the mouse but keep the point of rotation exactly the middle of the stage at all times. I.e. if the mouse is hovering over the exact center (both X+Y) of the stage then the 'ball' should have a tiny diameter of rotation (but contstantly follows the orbit in clockwise direction) whilst if you move the mouse towards the edge of the stage then the diameter of the orbit of the ball will increase. Here is the AS which controls a blank movieclip;

[Code]...

View 5 Replies

ActionScript 2.0 :: Object Following Mouse Cursor In SWF Limit?

Jul 25, 2005

I'm working with a site and I have a problem with one of the swf. The site is a group of some swf's (the root swf, where I call the menu, section1, section2, etc.). There is another swf, a banner. In this swf, I have a butterfly following the cursor. The problem is that it follows through the entire site and not just the banner limits.

View 3 Replies

ActionScript 3.0 :: Position Mc's Along X Gradually

Sep 8, 2009

I don't know which is the best way to explain this, but I am making an accordion-style xml menu and I would like to position my items from left to right so that their "x" and "alpha" property increase gradually, as if it was calculated from Strong.easeIn, if you know what i mean.How would one go about this in actionscript?

View 2 Replies

ActionScript 3.0 :: Direct Rotation Between The Object And The Mouse

May 2, 2009

right now I have a code that rotates an object based on the position of it and the mouse. Thats all great but it sucks for a game, It is way too responsive. What I tried doing is making to rotation var:

[Code]...

after that I made rot2 the direct rotation between the object and the mouse: rot2 = Math.atan2(Ydiff, Xdiff) * 180/Math.PI; //(forgive me if this has spelling errors, as I am writing it //by hand right now) then I make rot effect the object: object.rotation = rot; now that the basics are set up I just need to make a code that compares rot2 and rot, if rot is less than rot2 it adds on to rot, if it is greater, then it will subtract.

(source at bottom) this all works well until you hit the most annoying part, the one i cant figure out how to fix.... basically there is a gap where the numbers go from 180 to -180, so the code flips out, reads this as it is supposed to, but this makes the object rotate a full 360 degrees around instead of just like 2 degrees to bridge the gap. If anyone has insight on this or thinks they might know what to do,

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Gradually Moving Y Position Of MovieClip

Dec 3, 2010

I'm totally new to ActionScript and don't really know what I'm doing yet! I have an assignment due Thursday and one of the things I'm currently stuck on is: I'm trying to get the water in a beach scene to gradually move down the screen until it fills the screen (and then the game will be over). At the moment I'm trying to do this using a timer event, is this right?

View 4 Replies

ActionScript 2.0 :: [FMX] Rotation And Elasticity - The Clip Snaps Directly Back To Its Original Position When The Mouse Leaves The Clip

Sep 9, 2003

I have a clip that rotates to orient itself towards the mouse when the mouse is over a given area. When the mouse leaves the area, the clip snaps back to its original position.

1) the clip snaps directly towards the mouse at the moment the mouse enters the clip; I would like it to actually rotate;

2) the clip snaps directly back to its original position when the mouse leaves the clip; I would like it to ease back into position.

[Code]...

View 3 Replies

ActionScript 3.0 :: How To Limit An AS3 3D Rotation

May 19, 2009

I've followed the little tutorial on Kirupa explain the rotation on X/Y/Z and I used these codes to play around.[code]howcan I improve this to somehow limit the rotation of my object allowing it to rotation on the X axe from -100 to + 100, and so on ??

View 2 Replies

Mouse X Position Altering Object?

Nov 20, 2009

I want to do something which is probably pretty simple but I've got absolutely no idea how to do it!What I want is for the Alpha value of an object (movie clip) to change depending on the x position of the mouse. So when the mouse is at 0 the alpha of the object will be 0%, and when it's at 100 the alpha will be 100%

View 4 Replies

ActionScript 2.0 :: Sailing Game - How To Limit Rotation

Sep 9, 2009

I am designing a sailing game and I am trying to limit how many degrees it can turn.

onClipEvent(load){
var speed:Number = new Number (-1)
} onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
if(Key.isDown(Key.RIGHT)){
_rotation +=3
[Code] .....

View 1 Replies

ActionScript 3.0 :: Limit The Dragged MC To A Certain Area With Rotation (joystick)

Jun 13, 2011

I've made a big empty circle, made it into an MC and it has the instance name of "MC"

I've made a small circle, made it into an MC and it has the instance name of "button". It's placed in the center of the big MC. The button MC has 2 frames, one with the small circle being in the middle, the other one with the small circle being at the edge with a pin under it.

I can't figure out how to do this, which is: when the user grabs the small circle, he can only move it around in circle at a fixed distance from the center of the big MC, thus not leaving the big mc area. When the user starts dragging the button, it should go to frame 2 in the button.

What I try to do here is a joystick, when the user releases the mouse, the joystick head goes back to the middle. When dragging the joystick head, the stuff on frame 2 inside the buttom mc should be rotated having the bottom of the stick fixed to the middle of the big circle.

Here's sadly the only code I have:

Actionscript Code:
button.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownEvent);button.addEventListener(MouseEvent.MOUSE_UP, mouseUpEvent);function mouseDownEvent(e:MouseEvent):void { 

[Code]....

View 1 Replies

ActionScript 2.0 :: Panning Object Relative To Mouse Position?

Jan 28, 2010

I have an flash file which is 740px wide and a movie object inside it which is 1100px wide. What I want to happen is for the movie to scroll left or right depending on the mouse position and to stop when it reaches the start or end of the movie object. It all works fine except when it gets to either end, the _x position is outside the boundaries I have set in the if statement so it wont scroll back again.Code is below:

ActionScript Code:
onClipEvent (load)
{

[code]....

View 2 Replies

IDE :: Changing An Object's Size Depending On Mouse Position?

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

Actionscript 3.0 :: Rotation A Wheel/circle With Mouse (Hold Mouse)?

Apr 19, 2011

i create this code but i cant spinning it with mouse (when i hold it)

Code: Select allmthr.addEventListener(Event.ENTER_FRAME,rotate);

function rotate (e:Event)
{[code]....

View 3 Replies

ActionScript 3.0 :: Calculate Position According To Rotation?

Jun 16, 2011

I have child (1) and I am rotating it by some custom num of degrees. After rotation (2) I want to 'align' this child to left_center side of the parent (should look like 3). Without roration I would set x to 0, but after rotation position of registation point changes.

way to calculate new x/y position based on rotation.

View 6 Replies

ActionScript 2.0 :: MC Movement - Rotation And Position

Apr 24, 2005

I'm having a problem with a little movement script I wrote for a MC I have. I believe it either has to do with variable scoping, or with a coordinate system problem. (If I change the xPos and yPos in the onClipEvent (load) to 0,0...then the MC starts in the middle of the field (MC) I'm trying to move it inside of.) Basically...the ActionScript you see below is a part of the "Player" MC...who is supposed to move around a "field" MC I have.

I was assuming setting xPos and yPos to 0 would have the Player MC starting at the very top left of the entire screen...which instead it starts in the middle of the "field" MC.) Also - When I press the different arrow keys...the Player MC jumps around to different locations...but once at the new location the movement (in a single direction) works okay.

[Code]...

View 11 Replies

ActionScript 2.0 :: MovieClip Movement / Rotation And Position

Apr 24, 2005

I'm having a problem with a little movement script I wrote for a MC I have. I believe it either has to do with variable scoping, or with a coordinate system problem. (If I change the xPos and yPos in the onClipEvent (load) to 0,0...then the MC starts in the middle of the field (MC) I'm trying to move it inside of.) Basically...the ActionScript you see below is a part of the "Player" MC...who is supposed to move around a "field" MC I have.

(I was assuming setting xPos and yPos to 0 would have the Player MC starting at the very top left of the entire screen...which instead it starts in the middle of the "field" MC.) Also - When I press the different arrow keys...the Player MC jumps around to different locations...but once at the new location the movement (in a single direction) works okay. I've attached the .swf.

onClipEvent (load) {
speed = 2;
xPos = 0;
yPos = 0;
this._x = xPos;
this._y = yPos;
[Code] .....

View 11 Replies

ActionScript 2.0 :: Mouse X Position To Control Movie Position?

Feb 1, 2006

Basically the x position of the mouse should control the play position of a movie. Do I need something like an event handler (I'm not sure exactly what these do, but I've seen similar scripts that seem to use them).

View 2 Replies

IDE :: Cursor Position Not Mouse Position In Input Text Box

Nov 12, 2009

I have an Input Text area that users can edit and then submit. I need to be able to show, on screen, the cursor's current position as they type. I don't need to know where the mouse is but all work-arounds I've found so far can only tell me the mouse position. The font for the text is 'courier' or 'courier new' and the Input Text area is scrollable.

View 8 Replies

ActionScript 2.0 :: Tween From One Position To Mouse Position?

Mar 28, 2010

tween from one position to mouse position

View 1 Replies

Actionscript 3 :: Flash: Moving A Movieclip From A Container To Another While Keeping Same Position And Rotation

Feb 22, 2012

I have 2 container MovieClips (mc1, mc2), each of them has a separate x,y, rotation. I want to take a child from mc1 and addChild() it to mc2 while keeping the same x, y, and rotation on the screen so you see the added child mc as if it didnt change position or rotation, just moved to the other MC.

View 3 Replies

Actionscript 3 :: 360 Rotation Degrees To 2d Object From 3d Papervision Object

Mar 11, 2010

I have a papervision camera of which turns using keyboard input, I have a radar of which I would like to orientate to direction when the camera turns.I have it all working apart from mapping my (camera) DisplayObject3D.rotationY to RadarInterface.rotation correctly.The camera (or any 3d object) works with values I'm finding hard:Clockwise: 0 to 89, 89 to 0, -0 to -89, -89 to -0 doing a complete 360.So if I were to turn 180 degrees I'd go from 0 to 90 and back down to 0 again.

View 1 Replies

ActionScript 2.0 :: Limit Area For Mouse Action To Pan

Oct 31, 2007

I have a code that i took from a file and i would like to modify one thing. The code below allows mouse movements to scroll multiple layers at different paces. The problem is that i want to limit the mouse movement area to just a center rectangle and not the entire stage. Is there something in the code below that would allow me to "define an area" for mouse movements to activate the layer scrolls.[code]

View 9 Replies

ActionScript 1/2 :: Focus On Mouse Position When Zooming Movie Clip Using Mouse Wheel?

Oct 29, 2009

I have a map application that when I use the mouse wheel the map will scale up or scale down. The next thing I want to do is to focus on the mouse pointer while zooming on the part of the map.

I have this code...

function focusMousePosition(){    onMouseMove = function (){        Stage.width = _root._xmouse;        Stage.height = _root._ymouse;        updateAfterEvent();    }}
var mouseWheelListener = new Object();var wheelNum:Number;
mouseWheelListener.onMouseWheel = function(wheelNum){    focusMousePosition();    if (wheelNum > 0){        map._xscale *= 0.9;        map._yscale *= 0.9;    }else{        map._xscale *= 1.1;        map._yscale *= 1.1;    }}Mouse.addListener(mouseWheelListener);

View 3 Replies







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