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


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

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 :: 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

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 :: Start MC With Mouse Position

May 26, 2004

I'm trying to make a movie clip play when the mouse is in a certain position on the screen without using invisible buttons, coding this myself so far I've got

[Code]...

View 3 Replies

ActionScript 2.0 :: Start MC With Mouse Certain Position On Screen

May 26, 2004

I'm trying to make a movie clip play when the mouse is in a certain position on the screen without using invisible buttons, coding this myself so far I've got
_root.top = 319
_root.bottom = 445
yval = _root._ymouse;
if (_root._ymouse > _root.top) {
_root.flowers.play();
} else {
_root.flowers.stop();
}
Doesn't seem to work right.

View 3 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 :: 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 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

ActionScript 3.0 :: Go Back To Start Position?

Jan 30, 2012

I have a grid of letters. I want to create the else aspect, where if you don't drop the letter on any square, it'll return to its original position. Issue is I don't declare it's original position, i simply use placement on stage.

View 1 Replies

Can Start Player From Position 'pause'

Feb 22, 2008

- how can I start the player from the position "pause" (so without playing a song when I open the flash) (and so with the button in position "play")

- I would like to add the button "previous track".. what code I need to create into the "mp3player.as"? (I think the button is the same of next but with "negative image" and with different names..)

- for a button like "stop" what I have to do? (a button with a simple action like: stop(); or stopAllSounds(); ?) (I've tried but without success...)

View 3 Replies

Rotation Controlled By Mouse?

Apr 17, 2009

i was wondering if theres a way to link the amount and direction of an objects rotation to the mouse position. I want it so if you move the mouse far to the left the object spins fast anticlockwise but if you move it to the center it stops.

View 2 Replies

ActionScript 3.0 :: Gun Rotation According To Mouse?

Aug 15, 2009

I have done the rotation bit, but now i want to limit the rotation but i can't do it
this is my code -

PHP Code:
stage.addEventListener(Event.ENTER_FRAME, moveArm)
function moveArm(e:Event):void

[code].....

View 2 Replies

ActionScript 3.0 :: Zoom To Mouse Position Using Mouse Wheel?

Mar 9, 2010

Code:

addEventListener(MouseEvent.MOUSE_WHEEL,mouseWheel);
function mouseWheel(event:MouseEvent) {
Map.scaleX = Map.scaleX + event.delta*.01;
Map.scaleY = Map.scaleX;
}

The problem with this code is that it scales from the registration point (0,0). Due to the other transformations I'm doing to this image at various times, it isn't possible to move the registration point. The image is larger than the stage and the user is able to drag it around. I want the mouse wheel to zoom in on the place the mouse is hovering over (or at a minimum...the center of the "view" they have...aka the stage)I tried doing this:

Code:
internalPoint = new Point(Map.mouseX, Map.mouseY);
externalPoint = new Point(stage.mouseX, stage.mouseY);
var matrix:Matrix = Map.transform.matrix;

[code]....

Which, incidentally, I'm using that whole portion of code to zoom into the state they will be in when they use the mouse wheel.

View 1 Replies

Actionscript 3 :: Start Position Of IndexOf Search?

Nov 30, 2010

I'm using the indexOf method to search for a substring in a String variable in Actionscript 3. The indexOf method allows you to specify a second, optional parameter - the starting position for the search. However, I'm not sure whether the position returned by indexOf is relative to the very beginning of the string, or to this optional parameter.

View 1 Replies

ActionScript 3.0 :: Start A Line On MOUSE_DOWN-not A X_y Position

Feb 9, 2012

I want to drag a line from the mouse down anywhere on the screen but my problem is I can only do it from a set position eg.120,120.

Everything else is fine.

Here's my code:

var line:Sprite;
line = new Sprite();
addChild(line);

[Code]....

View 4 Replies

ActionScript 2.0 :: Moving X Position From Start To End State

Sep 12, 2007

I have this script, that zooms and fades the movieclip but I also need to shift the position slightly from the start state to the end state. For example var startX = 60 var endX = 70 so when the zoom start it starts at x = 60 and slowly moves as it zooms out to x = 70.

View 1 Replies

ActionScript 3.0 :: Mouse Drag And Rotation?

Feb 1, 2010

How do I rotate an object with the mouse after I have dragged the object with mouse.ssentially, I want to move the object with the mouse and then rotate it with another mouse click. Right now the object is moving and rotating at the sime time.

View 6 Replies

ActionScript 3.0 :: Determine The Rotation Using Mouse?

Jul 21, 2009

I want to know if there is a way to determine the rotation of mouse movements flawlessly. this will trace the direction I am going in.

[Code]...

View 2 Replies







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