ActionScript 3.0 :: Determine Clockwise Or Counter-clockwise Rotation?

Nov 9, 2010

I'm writing a class for an instrment and one of the knobs has "snapping" values at X degrees.I have the code to make the knob snap to the set degrees,but I'm having trouble getting it to determine whether it was rotated clockwise or counter-clockwise.Here is the function that makes it rotate and "snap" The majority of the problem is because of the 0/360 and negative values that Flash has when it rotates..
 
In the function:

the _baseMovieClip is the clip that contains a graphic to rotate and "snap" to the degrees.

the _clipToRotate is a movie clip that actually displays the rotation

the _startAngle is the angle the user clicked on the button that triggers rotation

the _rotateObj is a sprite that is drawn when they click that I make visible to show the actual rotation when I'm debugging

the _snapLock is the degrees the knob shold rotate to (10, 15, 30, etc)

private function calculateRotation(event:Event):void [code]....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Rotating Movieclip Clockwise And Anti Clockwise?

Jul 2, 2009

I have a movieclip called view_mc and a button btn_rotate.

I want when the user click and drag btn_rotate button, he can rotate the view_mc movieclip clockwise and anti-clockwise.

I have written a code, but it only rotates the movieclip in clockwise direction:

stage.addEventListener(MouseEvent.MOUSE_DOWN, on_stage_down);
stage.addEventListener(MouseEvent.MOUSE_UP, on_stage_up);
function on_stage_down(e:MouseEvent):void

[Code]....

View 8 Replies

ActionScript 3.0 :: Rotating Movieclip Clockwise And Anti Clockwise

Jul 2, 2009

I have a movieclip called view_mc and a button btn_rotate.

I want when the user click and drag btn_rotate button, he can rotate the view_mc movieclip clockwise and anti-clockwise.

I have written a code, but it only rotates the movieclip in clockwise direction:

ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_DOWN, on_stage_down);
stage.addEventListener(MouseEvent.MOUSE_UP, on_stage_up);
function on_stage_down(e:MouseEvent):void

[Code]....

View 1 Replies

Rotate An Item Counter Clockwise 1/2 A Time?

Mar 31, 2009

I am sure this is simple, but cannot remember how it is done. I just need to rotate an item counter clockwise 1/2 a time. The rotate option only accepts integers and when I do a motion tween it goes clockwise.

View 1 Replies

Flash :: Make A Counter Clockwise Circle Using Senocular's Path Class?

Feb 20, 2011

how to make a counter clockwise circle using Senocular's Path class?

For example, if I start a half-circle on the left (9 o'clock) it will go to 6 o'clock then 3 o'clock. Right now it goes for 9 o'clock to 12 then 3.

Works great clockwise... but I can't get it to draw in the other direction. I tried messing with the math inside the class and it exploded!

Here is a link to his source file: [URL]

View 1 Replies

ActionScript 3.0 :: Updating Rotation For Anti-Clockwise

May 19, 2011

I have a function that lets you click on a handle of a movieClip and rotate it. I recently updated my code to make use of Oscar Trelles DynamicMovie class so I could set a registration point in the center of the movieClip. But that has given me problems with being able to rotate the movieClip incrementally in an anti-clockwise manner.

The following code will let me rotate it clockwise, forever and ever. But I'm having a hard time wrapping my head around how to determine if the user user is dragging the mouse counterclockwise. The property mc.rotAng is set in a previous mouseDown event. It stores the previous mouse position, and the incremental angle of rotation is derived from the current mouse position and the old mouse position.

[Code]...

View 2 Replies

ActionScript 2.0 :: [FMX] Circle Disappear Clockwise?

Feb 27, 2003

Ok, here is my problem, hard to explain tho, but i will do my best.I would like a circle picture to dissappear (or appear) with like a clockwise motion. So basically from twelve oclock i want the circle picture start going away clockwise until it comes to twelve again and the picture would be all gone by then.

View 5 Replies

ActionScript 3.0 :: Rotate A Movieclip Clockwise And Counterclockwise

Jun 24, 2009

I have 2 movieclips. ro used for rotating and rect the movie that will be rotated.
 
I want when clicking and draging the ro movieclip clockwise or counterclockwise, the rect movieclip is rotated clockwise or counterclockwise respectively.
 
I allow the rect to be rotated according to mouseX and mouseY.
 
but it dose not work as I need.
 
I'd like you to show me a trick to achieve that as I want.
 
Here is the code:
 
var xPo:Number;
var yPo:Number;
ro.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down)
function mouse_down(e:MouseEvent):void

[Code].....

View 2 Replies

ActionScript 2.0 :: Drawing Squares In A Clockwise Manner, Using DuplicateMovieClip()?

May 4, 2007

one after the other in a clockwise manner, so that they form one big enclosing square. In my script, I have a square called cell_mc that I would like duplicate instances of cell_mc to enclose to form a bounding box. I would like the duplicate instances to be drawn one by one in a clockwise direction:

ActionScript Code:
// Get depth
var depth:Number = this.getNextHighestDepth();

[code]....

View 1 Replies

Adobe Flash CS4 - Making A Circular Arrow Spin Clockwise?

Aug 25, 2009

Adobe Flash CS4 - making a circular arrow spin clockwise

View 6 Replies

ActionScript 3.0 :: Generate A Random Point Moving Clockwise Within A Radius?

Jan 16, 2012

I wish to have a function that will take as input a radius value and a magnitude value.

It will return firstly a point (x,y) and also secondly a direction, (vx,vy) which will have a certain magnitude(speed).

The point returned will be a random point within the radius value and the direction will be a a (vx,xy) that moves the point perpendicular to the line segment (x,y) ->(centrepoint).

View 9 Replies

ActionScript 3.0 :: Rotate An Object (mc) Clockwise Or Anticlockwise Depending On The Value Of A Variable Called 'angle'?

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

ActionScript 2.0 :: Spin An Object In Clockwise And Anticlockwise Direction With Ease Via Press Of A Button?

Jul 16, 2009

i would like spin an object in clockwise and anticlockwise direction with ease via press of a button.tried using,

on (press) {
this.testmovieclip._rotation += 45;
}

just to get the object to turn... What i wanna do is have 4 buttons, 1st button turns the object 45 degrees, then 2nd button turns it next 45 degrees and so on... Have attached .fla of what im trying to achieve.

View 5 Replies

ActionScript 3.0 :: If I Rotate An Image 10 Deg Then That Moves An Image 10 Deg Clockwise From 0?

Apr 19, 2011

I have rotated an image around 0,0 using the code below. I need the new coordinates of the corners of the rotated image.

bitmap.rotation=_angle;

UPDATE: if i rotate an image 10 deg then that moves an image 10 deg clockwise from 0,0

the bottom left corner was 0,20 and so i need to change the point (0,20) 10 deg clockwise using trig?

View 1 Replies

ActionScript 2.0 :: Image Viewer - Crank Clockwise To Scroll Images Forward And Counterclockwise To Scroll Images Backwards

Apr 4, 2004

here is some code for a rotating crank that controls an image gallery. refer to the "image viewer stops?" thread in the flash mx forum (sorry don't know how to link to a forum yet!) for more info. attached is the fla. i want to be able to crank clockwise to scroll images forward and counterclockwise to scroll images backwards. If i keep cranking, i want the images to continue to change, if i stop cranking, i want it to stp on that image. it doesn't sem tooooo hard, i'm just numb from tryig to figure it out.

[Code]...

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

ActionScript 3.0 :: Determine Rotation Of Object To Stage?

Jun 18, 2009

How can I get the X, Y, and rotation values, relative to the stage of a child of unknown number of parents?

What I am doing is: I have a 'stick' object, that creates a child 'stick', that creates a child 'stick', etc a random number of times.

The end stick then creates a leaf.

Each new stick rotates a little bit randomly.

As a result when my leaf falls off the final stick it flies off in a strange direction.

How can I get the leaf to fall down (eg y++ relative to stage)?

Alternatively I thought I could dispatch an event that has a leaf created at the stage level but then I really need to know what the X and Y co-ordinates of my final stick is realtive to the stage.

View 2 Replies

ActionScript 3.0 :: Determine Rotation Of Child Object To Stage?

Jun 19, 2009

How can I get the X, Y, and rotation values, relative to the stage of a child of unknown number of parents?What I am doing is: I have a 'stick' object, that creates a child 'stick', that creates a child 'stick', etc a random number of times.The end stick then creates a leaf. Each new stick rotates a little bit randomly.As a result when my leaf falls off the final stick it flies off in a strange direction.How can I get the leaf to fall down (eg y++ relative to stage)?Alternatively I thought I could dispatch an event that has a leaf created at the stage level but then I really need to know what the X and Y co-ordinates of my final stick is realtive to the stage.

View 0 Replies

ActionScript 3.0 :: Determine The "rotation Point" (axis?) Of An Object?

Feb 19, 2009

How do you determine the "rotation point" (axis?) of an object?

A sprite/movieclip that has been loaded using a Loader has its rotation point set to the upper-left corner. What I want to know if how I manually (using ActionScript) set it to the center.

View 9 Replies

ActionScript 3.0 :: Rotation Center Is In Left Of The Image - Aren't 3D Rotation From Transform Panel

Jan 7, 2010

I have a movieclip and when I do 3D rotation from Transform panel, It rotates perfect, center is in the middle of image, and when I apply mc.rotationY, rotation center is in left of the image, aren't 3D rotation from Transform panel and mc.rotationY from AS same? what's up?

View 2 Replies

Actionscript 3 :: Augmented Reality Flartoolkit Rotation - Trace The Rotation Of The Marker

Mar 23, 2011

I'm trying to do some augmented reality projects with flartoolkit . I can now put simple 3d objects on my marker and it works fine , but I wanna give my project some events that the user can interact with. I'm trying to trace the rotation of the marker. there's a container:DisplayObject3D which my application uses to add the 3d objects , I traced this :"trace(container.rotationZ)" but it's just returning 0 . I studied another AR application's source code and it was using the rotation of it's container object without problem .and I think I should mention that I'm using the exercise file of seb lee delisle papervision3d course from [URL]. anyone has any experience with flartoolkit? the main functions of my my code is as below:

[Code]...

View 1 Replies

ActionScript 3.0 :: 3D Rotation Of Nested Movieclips, Separate Of Parent Rotation?

Aug 11, 2010

Is it possible to have the child movieclip rotate separate of the  rotation  properties assigned to the parent? so ultimately giving the  child  element it's own axis?I've customized Lee Brimelows (gotoandlearn.com) 3D carousel to spin  on  the x axis to make it a vertical carousel. I've also rotated that by 45 degrees on the y axis to see all the items, and wrote a snippet of   code to hide the left portion of the carousel. The entire  carousel is contained within the 'container' movieclip, and  inside of  that are my carousel items (as seen below), with the larger  item being  the item in focus.

On rollover of the item in focus, I want to rotate it so it faces the   viewer (as seen below),basically removing the 45 degree rotation   applied to the container.The problem i'm running into is when you rotate the container (changing   the rotationX of the container), the axis basically rotates with it, so   when i rollover the next item 'in focus', the following happens..(in  the  example where it appears how it want it to, the carousel is at a   rotationX of 0, so it works fine)

View 2 Replies

ActionScript 1/2 :: Inconsistent Rotation - 270 Degrees Of Rotation Disappear?

Apr 21, 2009

Program A has a cannon that aims to line up with where-ever the mouse is pointing, in 360 degrees, and fires when the mouse is is clicked. Program B has an eye instead of a cannon that should in theory do similar functions when the capslock key is toggled, but instead only has a 90 degree range of motion from the Right of the eye toward the bottom (quadrant 4 only). Where did the ther 270 degrees of rotation disappear to?

[Code]...

View 4 Replies

ActionScript 2.0 :: Create A 3d Rotation Much Like The Widely Used Carousel Only The Rotation?

Aug 11, 2006

i.m trying to create a 3d rotation much like the widely used carousel only the rotation i desire consist of four upright(90 degrees) movieclips resting on a slanted, 30 degree plane which rotate onEnterFrame or following a tween on a oval like path - then pause for a given number of seconds at the four movieclips positions equal in distance on the plane

function around() {
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = this._y /(centerY+radiusY);

[code]....

View 7 Replies

IDE :: Z - Rotation X And Rotation Y Missing In Motion Editor Panel

Feb 23, 2009

Why isn't there the Z, rotation X and rotation Y fields in my motion editor panel?

View 1 Replies

Actionscript 3.0 :: Rotation X Rotation Y Don't Show?

Oct 8, 2009

I am watching the tutorial on the motion editor and when he opens the motion editor to edit the Rotation X and Rotation Y values I'm in trouble.My motion editor now only shows Rotation Z but, no Rotation X or Rotation Y. What am I doing wrong?

View 1 Replies

ActionScript 3.0 :: 3D - Rotation Via MatrixTransformer - Do A "pseudo 3D" Rotation Of A Movie Clip

Dec 2, 2008

I am trying to do a simple "pseudo 3D" rotation of a movie clip. The clip would "flip" on to the screen. I have created the effect using PaperVision3D, however, the final SWF is about 64k and my project requires a smaller file size. I tried to create the flip effect manually by creating skewed versions of the clip and tweening between them, except this doesn't work because the shape is not tweaked along the vanishing point as it should be. It looks like perhaps I could accomplish what I want to do using the MatrixTransformer but I've not had much luck so far.

View 3 Replies

ActionScript 2.0 :: Pause Rotation On Rollover Of A Movieclip And Restart Rotation On Rollout Of The Movieclip

Oct 3, 2006

I'm trying to pause my rotation on rollover of a movieclip and restart rotation on rollout of the movieclip. Here is my current code,

[Code]...

View 1 Replies

ActionScript 2.0 :: CS3 MP3 Play Counter?

Jul 7, 2009

I have a AS2 mp3 player that i need to adapt to count the number of times the track is played over the web.I'm not sure how to do it, or what to research, as i have not done this sort of thing before? I just need to return a count variable from flash to some sort of back end document/file that is not displayed!

View 2 Replies

Score Counter That Follows Player?

Oct 13, 2009

so I've made a working score counter and all that working fine, but I cant find a way to make it follow the camera/player without glitching up.

View 1 Replies







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