ActionScript 3.0 :: Rotating Circle By Mouse?

Jan 31, 2010

I have been working on this and thinking about it for days but I just can't seem to get it right. I want to have a circle that I can "pick up" with the mouse and then rotate (with the rotation point in the center). Currently I have done this with the following code:


PHP Code:

 var radians = Math.atan2(mouseY-circle.y, mouseX-circle.x); var degrees = Math.round((radians*180/Math.PI));  circle.rotation = degrees + 90; 

I have added a mouse listener for movement to the circle mc and then checked if a button was down. On button down this code would be executed on enter frame. This code works but the main problem is that I want to be able to "pick the circle up" at any angle and rotate it. If I pick it up with this code the circle automatically rotates to 90 degrees.

View 14 Replies


Similar Posts:


ActionScript 3.0 :: Rotating Circle From Center With Mouse/

Jan 31, 2010

I have been working on this and thinking about it for days but I just can't seem to get it right. I want to have a circle that I can "pick up" with the mouse and then rotate (with the rotation point in the center). Currently I have done this with the following code:

PHP Code:

var radians = Math.atan2(mouseY-circle.y, mouseX-circle.x);
var degrees = Math.round((radians*180/Math.PI));
circle.rotation = degrees + 90;

I have added a mouse listener for movement to the circle mc and then checked if a button was down. On button down this code would be executed on enter frame. This code works but the main problem is that I want to be able to "pick the circle up" at any angle and rotate it. If I pick it up with this code the circle automatically rotates to 90 degrees.

View 1 Replies

ActionScript 2.0 :: Make One Circle Follow The Mouse Cursor Inside Another Circle

Sep 30, 2005

i want to make one circle follow the mouse cursor, inside another circle. Similar to an eye looking at the cursor. Ive attached an example.

View 4 Replies

Rotating Images In A Circle?

Jun 22, 2009

I have been given the task to create something similar to the flash navigation on the link below. I have tried googling things such as "flash image rotation", "flash rotation circle", etc?[URL]

View 1 Replies

Professional :: Looping A Rotating Circle Without Wobbling

Apr 6, 2011

I try to make a looping rotating circle but I have wobbling during the rotation. It seem that the problem come from Flash. I tried manually on the timeline, by the code... but no results. I would expect a PERFECT circle! Here is an example of my result: [URl] You can download the .fla here:[URL] The circle is 2000px*2000px, center is -1000px*-1000px I believe this one also displays the problem in another way: [URL]

View 8 Replies

ActionScript 2.0 :: Rotating Circle On Clicking Its Part

Feb 19, 2010

I need to make it so that when I click part of a circle, it'll rotate to show that bit at the bottom of the circle. I have managed to make this work for the first time you click, but beyond that it doesn't. My file is attached..

View 2 Replies

ActionScript 3.0 :: Rotating Arrow And Circle Definition

Oct 4, 2010

I'm currently working on a school project, where we have an arrow turning 360 degree around it's own center point. In the background there's a circle, which has been splitted up in 8 parts. The actionscript is as following:

Frame 1:
var vinkel:Number = 0;

Frame 2:
import flash.media.Sound;
stop();
//En timer der opdatere hvert 1/1000 sekund
var timer:Timer = new Timer(1);
omdr_txt.text = "Omdrejninger: " + vinkel;
[Code] .....

So it randomly turns a few rounds (usually between 2 and 3 rounds). Then when it, for instance stops at 15 degrees, or 1,05 rounds, then it will automatically go to a specific frame which has been defined for that interval (radius 0-15 for instance).

View 3 Replies

ActionScript 3.0 :: Rotating Circle In Both Directions Using Buttons

Oct 20, 2010

What I have is a circle image (for this purpose lets say it looks like a clock). For example: when you click 3 o'clock, the whole clock needs to rotate around with the 3 o'clock btn at the 6 o'clock position (with the pivot point in the centre). each of the 'time' positions (2 o'clock, 3 o'clock, 4 o'clock ...etc) needs to be a button and thus be able to rotate around to the 6 o'clock position. This would seem simple enough by just using a .rotate value or using tween movieclips...however the tricky part is:

The actionscript needs to determine which way the clock turns (anti/clockwise), dependant on where the clicked time-btn's position is. it needs to be some sort of if statement that says: If (3'oclock-btn) is positioned between 0 degrees (being original 12'oclock position) and 180 degrees (original 6 o'clock position), then rotate clockwise to the 6 o'clock position. If the (3o'clock btn) is positioned between 180degrees and 259 degrees (12 o'clock position), rotate anti-clockwise to the 6'oclock position.

View 3 Replies

ActionScript 3.0 :: Circle Menu Not Rotating Properly

Oct 26, 2010

I am trying to create a circle menu like the link below by searching through net I found some of the menus but not the exact one. Am attaching the menu which was created by me. The menu is not rotating properly. Link : [URL]

View 0 Replies

ActionScript 3.0 :: Rotating Multiple Objects And Every Circle Around It

Nov 17, 2011

I have an idea of a game in my head and I wan't to get somekind of functional demo of it done in flash (CS3). I've looked everywhere but couldn't find tutorial for it, as I'm not sure what I'm looking for. I'm not that good in Actionscript. I'm now trying to describe this problem. On screen there's 4 rectangles, 2 in a row. So it's 2 rows with 2 rectangles in each. between all of them theres 4 circles. If I activate a rectangle with mouse and use arrow keys to rotate it smoothly 90 degrees, 2 nearest circles rotate with it. And same thing happens with all of the rectangles.

So I'm looking for somekind of solution where rotating an object also rotates every circle around it. and when circle rotates 90 degrees with rectangle as it's center point, it can be also rotated with another rectangle. I think I can't explain this clearly?

View 3 Replies

ActionScript 3.0 :: Rotating A Circle To A Specific Point

Mar 6, 2009

What I'm trying to do is make a dial-type of interface, where you click on a point on the edge of a circle and that point will rotate to another point at the top of the circle. What I can't figure out is how the make "Point B" rotate to "Point A", where "Point A" is always fixed at the top of the circle and "Point B" (and Point C and Point D, etc...) are located along different points on the edge of the circle. I'm using the tween function to rotate, so what I need to figure out is how to get the difference in the rotation between the two points.

View 7 Replies

ActionScript 3.0 :: Rotating Point Around Center Of Circle

Mar 9, 2009

I am trying to rotate some points around the center of the circle(0,0), however I'm getting weird values from the output. I've commented the problem code..

Code:
var r:Number = 10;//radius
var y:Number;
var x:Number;
var a:Number = 90;//angle of which the semi-circle is facing.. could be a random angle.
var ax:Number;//rotated points
[Code] .....

I am using the semicircle in BitmapData collision checking with getPixel(), with a moving circle...

View 1 Replies

Professional :: Looping A Rotating Circle Without Wobbling?

Aug 27, 2004

I try to make a looping rotating circle but I have wobbling during the rotation. It seem that the problem come from Flash. I tried manually on the timeline, by the code... but no results.I would expect a PERFECT circle ![URL]The circle is 2000px*2000px, center is -1000px*-1000px

View 6 Replies

ActionScript 2.0 :: Rotating Draggable Point About Circumference Of Circle?

Mar 25, 2007

How to make a point rotate about the circumference of a circle upon dragging. How do I go about doing it? Is there something to do with the
startDrag(...); ?
From what I have right now, I can move the point but not on the circumference of the circle.

View 3 Replies

ActionScript 2.0 :: Rotating Circle Around Its Centerpoint Slowly Forth / Back

Aug 29, 2003

I am still quite new to AS. I'd like to rotate a circle (compass_mc) around its centerpoint slowly forth/back with +/- 45 degree...or better with random degree. As file size is important, I can not solve it with MotionTween. Up to this time I applied this code to the MC, which endlessly rotates it:
iranytu_mc.onEnterFrame = function(){
this._rotation+=1;
}
How to apply that sort of random slow forth/back rotation to the circle with AS?

View 4 Replies

ActionScript 3.0 :: Rotating Circle - Controlling Movement Left And Right By Buttons

Aug 3, 2009

I have a big circle with buildings all around the edge. There are two buttons that should control it. One to rotate the circle left, and one to rotate the circle right. I'd like each click of a button to rotate the circle and have it stop on a building, which then would activate an animation of the building.

View 4 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

IDE :: Mouse Follow On A Circle With Ease?

Apr 21, 2009

i have a script for my project that exactly does what i want but the only thing missing is i want it to follow the path with ease . that i couldn't figure out. here is the code you can copy and past it on the first frame of a flash project and it will work:

var s = _root.createEmptyMovieClip("circle", 10);
s._x = 250;
s._y = 200;

[Code]....

View 2 Replies

ActionScript 2.0 :: [CS3] Rotating Using Mouse Coordinates

Mar 12, 2008

I'm trying to create a simple site that when you move the mouse to the right of the screen a movie clip rotates one way abt 45 degrees and moves the other way when the mouse moves to the left.

I'm trying to get the effect of a horizon line rotating to the mouses movement around the screen.

View 10 Replies

ActionScript 3.0 :: Rotating A Movieclip Using The Mouse?

Mar 30, 2009

I have been trying to convert this effect into AS3 but have been having majour issues : rotate clip

I have an object (class) with a handle, when dragged I would like the clip to rotate with the mouse (much like rotating an object in photoshop). I have put my code into an ENTER_FRAME event, and have been using a matrix object to do my rotation (is there an easier way?)

Code:
private function rotateClip(e:Event)
{
myMatrix.rotate((Math.floor(180*Math.atan2(mouseX,mouseY)/Math.PI)+90));

[Code].....

was my attempt at converting the code from the example link. I've also tried various other methods using trig to no avail.

View 1 Replies

Object Following Mouse, Rotating Left And Right?

Oct 11, 2010

I am working in AS2 and I have a flash project that is almost complete but I would like 1 thing modified.I have a fish image following my mouse.

(script below)
onClipEvent (enterFrame) {
_root.yChange = Math.round(_root._ymouse-this._y);[code]...........

The problem is that I would like the fish image to "turn" and face the direction of the mouse. Currently, as is, the fish follows the mouse fine when the mouse is moving to the right, but when it goes to the left the fish swims backwards rather than turns and swims the correct way following the mouse to the left.How would I modify the script to get the fish to turn and always swim forward when going left and right?

View 3 Replies

ActionScript 1/2 :: Rotating Through Frames Via The Mouse?

Sep 21, 2009

I am working on an animation that I need to rotate in flash, via the mouse?
 
Is there a way to cycle through the frames left and right via the movement of the mouse?

View 8 Replies

Actionscript 3.0 :: Rotating To The Mouse Position?

Apr 8, 2009

Im trying to follow an example and get a simple arrow sprite to rotate to the mouse position. This example comes out of the book 'Foundation Actionscript 3.0 Making things move' however when I build the following .as files, open a new as3.0 document, assign the document class to RotateToMouse, run the movie the swf's stage is blank and lacking the arrow sprite im telling it to create.

Code:
Code: Select allpackage
{

[code]....

View 1 Replies

ActionScript 3.0 :: Scale The Circle When The Mouse Is Idle?

Oct 2, 2011

when the mouse is idle, dynamically create a circle and scale . the scaling has to depend on the mouse idle time.. so here i couldn't scale the circle, but all other are done. am put the code here.

CODE.................
import flash.display.MovieClip;
import fl.transitions.Tween;
import fl.motion.Tweenables;

[Code].....

View 5 Replies

ActionScript 2.0 :: Rotate Circle With Mouse Movement?

Jul 15, 2009

I'm trying to make a dummy from a circular menu that reacts (rotate) to mouse movement, I uploaded a fla example, different colors, size, etc, but essentially the same in function; but for now I'm freezed how to do somethings, I'm not a programer or actionscripter, but I want to learn.Currently using CS3 and AS2, downloading the FLA example may help. in the "fla", you will see a circle who rotates versus mouse movement (I would like to make a delay rotation for a smooth feelling when mouse is moving, those like "_x += (_xmouse/5)" but with rotation. Other thing I would like to do,is... that the movement stops progressively a few degrees before the mouse reach de cian angles(a1,a2), and then, the circles doesn't move if the mouse is moving under those angles, like a... an inactive area(U1), and if it could work with instances.

View 0 Replies

ActionScript 3.0 :: Create Circle On Mouse Click?

Dec 5, 2010

I write some working code that creates a circle on mouse click with a radius of 5 and with a random colour each time...I have the code to create the circle and the code for the random colour here:

var myColour:Number = Math.floor(Math.random()*0xFFFFFF);
this.graphics.beginFill(myColour);
this.graphics.drawCircle(0, 0, 10);
this.graphics.endFill();

Essentially I want to create a Flash application that places random coloured circles with a radius of 5 on the stage with a centre location of the mouse position each time a user clicks.

View 5 Replies

ActionScript 3.0 :: Scrolling Circle In Direction Of The Mouse?

May 13, 2011

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]...

View 6 Replies

ActionScript 2.0 :: Rotate Circle With Mouse Movement

Jul 15, 2009

I'm trying to make a dummy from a circular menu that reacts (rotate) to mouse movement, I uploaded a fla example, different colors, size, etc, but essentially the same in function; but for now I'm freezed how to do somethings, I'm not a programer or actionscripter, but I want to learn. Currently using CS3 and AS2, downloading the FLA.

Ok, in the "fla", you will see a circle who rotates versus mouse movement (I would like to make a delay rotation for a smooth feelling when mouse is moving, those like "_x += (_xmouse/5)" but with rotation. Other thing I would like to do,is... that the movement stops progressively a few degrees before the mouse reach de cian angles(a1,a2), and then, the circles doesn't move if the mouse is moving under those angles, like a... an inactive area(U1), and if it could work with instances.

View 1 Replies

ActionScript 2.0 :: AS2 Hittest On Rotating Shapes /w Mouse

Mar 27, 2011

I've googled for hours and found nothing. I did find a lot but none involved hittesting with a mouse cursor. I'm trying to make a simple maze game, so far it works, I die when I hit squares and rectangles, but I die incorrectly when hitting a rotating rectangle.Because it rotates, the bounding box is larger and a normal hittest sees bounding boxes, meaning it won't work.Make it so that my mouse can go near the rotating rectangle without dying until I actually touch the actual rectangle instead of the bounding box.

View 2 Replies

ActionScript 2.0 :: Whenever Move Mouse Over It , It Should Stop Rotating?

Jan 28, 2009

am new action script just started to learnstarted with 2.0 i had small scenario imagine any shape which is in rotating motion through motion tweennow what i what is through AS whenever i move mouse over it , it should stop rotating

View 1 Replies







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