Actionscript 2.0 :: Rotate Object To Certain Degree Then Stop?
Apr 24, 2009
I want to smooth rotate thing_mc a certain amount when home_btn is pressed. Not sure how to do this. Obviously the below doesn't work.
Code: Select allhome_btn.onRelease = function(){
onEnterFrame = function (){
thing_mc._rotation += 5;
[code].....
View 4 Replies
Similar Posts:
Mar 5, 2010
how to rotate an object 360 degree in as3
View 2 Replies
Feb 8, 2011
I've got a 3D model at hand, which I have imported as a movie and an image sequence of each frame depending on which is necessary. I basically would want to rotate it by 360 degree both on the x and y axis on a canvas as well as having that done manually, such as having to drag my mouse to control which direction the model rotates in. Can I do this in Flash?
View 5 Replies
Jul 6, 2005
I have a cross shape that on button release I need to rotate clockwise 1 degree at a time for 360 degrees, stopping at each 90 degree point. Then continuing from that point when the button is released again, when the button has been clicked 4 times the cross will have made a complete circle. This needs to be available at all times
The catch is, I also need it to do the exact same thing counter clockwise from the release of another button at all times.
So for example imagine a stopwatch with 60 seconds, when one button is released the second hand starts counting clockwise 1 second at a time til it reaches 15 seconds then it stops.
Then when the same button is clicked again it starts from 15 seconds and goes to 30 seconds and stops, then on to 45 when the button is clicked and so on back to its original state at the 0 second point. Then there is another button that makes it go backwards from wherever it currently is for 15 seconds back.
View 5 Replies
Sep 5, 2002
i'm trying to create an actionscript where i can rotate a symbol in a continuous full 360 degree at one position. i know it has to do with degree/pi, but i can't come up with the correct formula for it. if i can try to remember, is it 2(pi) for a full rotate? how to put it in the actionscript?
View 8 Replies
Oct 4, 2010
I want to rotate an object using the arrows on the keyboard when the mouse is over the object and it should not be possible to rotate the object when the mouse is not on the object. I know how to rotate the object, when the mouse is over the object, but when I put the mouse outside the object I can still rotate the object. How do I make the rotation stop?
[Code]...
View 4 Replies
May 14, 2010
here is my code,
[Code]....
This is running on Enterframe but I want to ratate 180 degree and on button press and hold button
View 1 Replies
Aug 10, 2009
I am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...
View 1 Replies
Aug 2, 2011
I have an object called point that I can move around the screen with my mouse. This object has a vector mapped through it (_v1) using the center of the stage and "point"s x,y location in order to draw the vector (note all of this is working fine). My problem is occurring when I set up was a button that simply sets a value to true if you press it. The idea behind this button is that when pressed, whatever location "point" is at, it will move 1 degree clockwise in a circle around the center of the stage (this is all happening in the frameHandler so I can keep clicking the button to make it continue around the stage).
The code I am using is based in an if statement listed below:
if(clockwisePressed) {
var v1angle:Number = _v1.angle;
v1angle++; //increase the angle by 1 degree
if(v1angle>180) {
v1angle -= 360; }
[Code] .....
So what is happening here is that clockwisePressed has been set to true so this fires off. My vector (_v1) is set up to tell me the angle (already converted from radians to degrees) but it's a read-only value. So I assign it (_v1.angle) to v1angle so I can mess with it and increase it by 1 so I'm moving clockwise around the center of the stage. Then I just check to make sure that it falls into a range between -180 and 180 (if I trace _v1.angle around the stage, 0 degrees is to the left, 90 degrees is straight up, 180 degrees is to the right, and -90 is straight down). Now using the formula I derived from this thread but converted to work with 0 degrees pointing to the left and the value for Y going up the further down the stage you go, I came up with
x = centerX - radius * cos(angle)
y = centerY - radius * sin(angle)
Now when I make a sample chart on paper and use these values on my calculator, this works like a charm. If I plug in an angle, the radius, and center I get a point right on my circle I draw on a sheet of graph paper. However, when I actually try this in flash, the "point" jumps all over the stage. (Note that _v1.m is just the magnitude of the vector between the center of the stage and "point" which is the same as the radius). So I trace everything and the values for cos and sin don't seem to be coming out right. For example, if my angle is -1.9581 and I take the cos of that on my calculator I get something along the lines of 0.9994 but flash traces Math.cos(angle) to be -0.3777. Isn't using Math.cos(-1.9581) the same as putting -1.9581 into your calculator and hitting cos?
Below is the corrected code that works:
if(clockwisePressed) {
var v1RadAngle:Number = Math.atan2(_v1.vy, _v1.vx); //get angle in radians
v1RadAngle += 0.0174; //increase the angle by ~1 degree more or less
//Now just move the crosshair and get it ready to be redrawn
point.x = centerX - _v1.m * Math.cos(v1RadAngle); //_v1.m = radius
point.y = centerY - _v1.m * Math.sin(v1RadAngle);
clockwisePressed = false; //remove button pressed boolean
}
View 1 Replies
Oct 29, 2003
how can i grab an object and rotate it with an object which is on it rotating [meaning that the second object is on the same possition on the first object?] can i make it being horizontal all the time?
View 14 Replies
Jan 27, 2010
I have an object that points in the direction of another object (i.e. it rotates to the direction that the second objects x and y coordinates are at) below is the code I use.
var distx = target.x - x;
var disty = target.y - y;
var angle:Number = Math.atan2(disty, distx);
[code]....
as you can see. Not only does it rotate towards the target object, but it also moves towards it too. When I play the movie, the object instantly points to the targeted object and moves towards it. I would like for it to slowly turn towards the object instead of instantly turning towards it.
View 3 Replies
Mar 6, 2011
botonDerecho.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, giraDerecha);
private function giraDerecha(e:InteractiveScene3DEvent):void
{
[code].....
View 7 Replies
Oct 6, 2010
I am working on a car game in flash where you see the car from a top view and you go straight ahead all the time on an endless road.
The game so far is built in the way that I have a image of a car that's the main car and the road is a image itself that keep switching with another image of the road and when you play it it looks like the car is moving very fast. But actually the car is not moving at all except for when you move it yourself by going right or left.
When turning right I do not want the car to simply move to the right, but I also want it to rotate a bit so it looks more realistic when turning.[code]...
View 1 Replies
Sep 23, 2004
Rotate an object using AS and also control the speed it rotats at?
View 4 Replies
Nov 7, 2002
I have a project I'm working on that requires a box to be rotated aropund an offset axis by dragging a button in one corner of the box. Most of the scripting for this works great, but there are a few things I can't work out. The box is limited to an up and down position (0 degrees and 90 degrees respectively). This is what I want to happen � when the user drags the box from the up position and releases somewhere between 10 and 80 degrees, the box continues down to the end down position on its own. If it begins on the down position and is released midway, it continues up. For some mathematical reason, my version likes to orient around 50 degrees.
View 4 Replies
Apr 13, 2009
i have this code on a button inside a mc:
on (press) {
rotateCWscreen1.onPress = function() {
screen1.onEnterFrame = function() {
[code]....
View 11 Replies
Oct 4, 2010
I'm using CS3 with ActionScript 3.0. What I want is simple, and I've done some searching but nothing that can get me the right results.I'm going to post a link that does exactly what I want: http:[url]......This rotates the circular object around a center point in a way that you can distort the object yet is still remains turning in a circular motion. A simple motion tween rotating the image will only work if the object is perfectly round, so distorting the object to make it more straight or curved won't work with a simple tween. I want to do exactly what is happening here (with my own object), is there some AS3 behind the scenes here making this turn on a center point?
View 3 Replies
Feb 21, 2012
I have an object that I want to rotate in 3D (letter "Y"). I have some code that I gathered and edited a bit, but right now it rotates at the top left as it's anchor. I'm trying to get it to rotate at the "crux" of the Y (absolute center), so it basically rotates in place.
My second problem is the speed. Ideally it needs to rotate very fast then slow down and stop. Any thoughts on how to either clean up this code to make it work? I could try it with just transforming the shape, but I'm trying to see if it can be cleaner with Actionscript.
[Code]...
View 3 Replies
May 26, 2011
I have an object I need to rotate by clicking and dragging. Following some AS2 code I got the object to rotate a bit every time the mouse is clicked, but can't get it to work with drag.
needle.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
function fl_ClickToDrag_2(event:MouseEvent):void
[Code].....
View 1 Replies
Feb 12, 2009
I have a color wheel with a triangle inside. I want the user to click and drag the triangle on its center axis. This way, the triangle shows the user the correct color triad.
I can't even rotate anything.
View 3 Replies
Dec 11, 2002
I've done the drag and drop part, The only script left is the furniture rotation like you see on this page:[edited URL to my link]This one uses a rotation button...is this the best way to do it?
View 14 Replies
May 21, 2003
How do i make an object rotate?
View 2 Replies
Apr 9, 2010
I need rotate an isometric object by actionscript.
View 3 Replies
Oct 11, 2002
I know it's possible to scale and rotate an object by using some actionscript. Is it also possible to distort an image?
For example; keep the topleft corner and the bottomleft corner of an object at the same position and put the topright and bottomright corner of the same object 25 pixels down.
View 14 Replies
Dec 13, 2009
When motion tweening is it possible to have an object move from point A to B and also have it rotate at certain points?
View 2 Replies
Feb 6, 2010
Would like to develop simple (in browser) puzzle games where shapes (such as a puzzle piece shape) can be simultaneously dragged and rotated, then dropped on the screen or canvas. The game mode would be to click and drag the shape or object, while simultaneously rotating the piece using arrow keys Is this possible in Flash? This simple general activity of simultaneous drag and rotate, then drop, is my intended overallweb site game basis. I'm new to Flash but have developed Windows executables for many years. I'm trying to decide whether to purchase and learn Flash as platform for interactive educational puzzle games running in browser windows.
View 4 Replies
Jul 23, 2010
How can I make a button rotate another object, like this:
There is an object, button and input text field:when I put the number 1 in the input text field, and then click the button, i want to rotate the object by 90° degrees.
How can I do this using ActionScript 3.0 and Adobe Flash Professional CS5?
View 21 Replies
Oct 4, 2010
I'm using CS3 with ActionScript 3.0. What I want is simple, and I've done some searching but nothing that can get me the right results. I'm going to post a link that does exactly what I want:This rotates the circular object around a center point in a way that you can distort the object yet is still remains turning in a circular motion A simple motion tween rotating the image will only work if the object is perfectly round, so distorting the object to make it more straight or curved won't work with a simple tween. I want to do exactly what is happening here (with my own object), is there some AS3 behind the scenes here making this turn on a center point??
View 5 Replies
Feb 21, 2012
I have an object that I want to rotate in 3D (letter "Y"). I have some code that I gathered and edited a bit, but right now it rotates at the top left as it's anchor. I'm trying to get it to rotate at the "crux" of the Y (absolute center), so it basically rotates in place.My second problem is the speed. Ideally it needs to rotate very fast then slow down and stop.Any thoughts on how to either clean up this code to make it work? could try it with just transforming the shape, but I'm trying to see if it can be cleaner with Actionscript
ActionScript Code:
scaleDirect = -1;
function dec2hex (dec)
[code].....
View 2 Replies
Sep 3, 2004
Im looking to rotate an object 360' around its registration pointer thing. The only problem is i dont know where to strat.
View 2 Replies