ActionScript 2.0 :: Make A Wheel Graphic Rotate A Certain Number Of Degrees To Loop The Animation?
Nov 12, 2002
I 'm a Flash novice trying to make a wheel graphic rotate a certain number of degrees using Actionscript to loop the animation, and use an if/else statement to check if the rotation is true. I cannot get it to work.
View 11 Replies
Similar Posts:
Mar 30, 2009
Flash CS3 Actionscript 3.0
Most of them have been random "wheel of fortune" type projects and those get me close, but most of them are in AS 2.0 and don't hit exactly what Im looking for.
So here is what I need:
A wheel with 4 sections and a button.
When you press the button, the Wheel rotates 90 degrees, easing into the rotation and easing out of the rotation.
Sounds simple right? Well, I got the easing part down and the code i have is designed to rotate 180 degrees. However, the trouble is that, my wheel code only works once, and only rotates the wheel once. Im having trouble making the code keep track of the wheel position and rotate from the position that it left off at.
Ultimately what will happen is, each of the 4 sections will trigger a sound loop. So each of the 4 sections will also have a hitTest function, but that is not my concern right now. I just want the rotation mechanism down pat. Here is my messy, overcomplicated code for your consideration (again, designed to rotate 180 degrees for simplicity but I need 90 degrees):
var i:int = .01;
var s:int = 10;
//add event listener for my_btn
my_btn.addEventListener(MouseEvent.CLICK, wheelRotate);
[Code].....
View 11 Replies
Jan 6, 2005
how to make a wheel spin 360 degrees in a seamless motion?
my purpose is to give realism to a car wheel which will spin in a seamless motion; Iļæ½ve tried to to it with tweening but the wheel mc jerks at every rotation; a couple of years ago I saw a very simple code which did exactly this , to make a wheel spin around smoothly;
View 7 Replies
Mar 15, 2007
Im trying to get these five buttons to rotate to differrent degrees using a narray and for loop. However, when I do this, it just takes the last value (-12) and applys it to each button.Check out my code:
Code:
ogRotation = [0,-3,-6,-9,-12];
for(var i=0; i < 5 ;i++){
test = ogRotation[i];
[Code]...
Also, should I just be doing each button seperatley?
View 2 Replies
Jan 18, 2009
I want to write a function to make a movie clip rotate 90 degrees but I can't figure it out. I'm using as3
View 1 Replies
Jul 6, 2011
how do i simply rotate a txtField to 270 degrees?
when i do this my text disappears:
txt.rotation = 270;
View 5 Replies
Mar 17, 2009
i have a stick id like to drag and rotate. ive followed a nice tutorial for it, and it works fine but i only want to rotate my stick 45 degrees when i click it. the tutorial i followed only alows my to rotate 180 degrees ??this is the code ive used
Code:
handle.grip.onPress = function() {
handle.onMouseMove = function() {
[code].....
View 3 Replies
Aug 9, 2010
How do I rotate a movieclip 360 degrees over a period of time? Can I use "new tween" ? I am trying to rotate the movieclip while it is moving from position y to y+50 (this is done using new tween)
View 1 Replies
May 26, 2010
With AS3 i must draw an arc with diameter x and a line in the middle of the arc with length x (kind of umbrella). Then, I need to rotate the umbrella in x degrees. The rotation point is on the end of the line(not the middle of the umbrella).
View 6 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
Aug 22, 2011
I'm trying to make a 3d cube rotate only in the x-axis 90 degrees when you press a button and 90 degrees the other way when you hit another. I have this code to get the 3D:
Code:
// formation of 3D Cube2 starts here
container.getChildAt(0).rotationY = 90;
container.getChildAt(0).x = -75; // move the on of side panel to 75px right;
container.getChildAt(1).rotationY = -90;
container.getChildAt(1).x = 75; // move the on of side panel to 75px left;
[Code] .....
And the cube rotate to one side or to another. But it rotate only a little each time I clicked some of the buttons and I want that the cube rotate 90 degrees with an animated movement. How can I get this?
View 5 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.So when you press the right key it rotates 5 degrees even if you keep holding it and when you release the button it rotates back quickly.The script I'm using:
onClipEvent(enterFrame) //This
{
if(Key.isDown(Key.LEFT))[code].....
View 2 Replies
Jan 24, 2010
How can I rotate an Image eg. 180 degrees clockwise using the Matrix. I can use the following code to rotate the image 90 degrees, but it is incremental, meaing
var matrix:Matrix = new Matrix();
matrix.rotate(Math.PI/2);
matrix.tx = imgControl.content.height;
var bitmapData:BitmapData = new BitmapData(imgControl.content.height, imgControl.content.width);
bitmapData.draw(imgControl.content, matrix);
imgControl.source = new Bitmap( bitmapData);
[Code]...
View 1 Replies
Mar 26, 2011
I wonder if box2d has some options for doing that?I am trying to apply angular velocity atm, but don't know where to stop rotating.So object which needed to rotate to 90 degrees, can't stop rotating....
View 2 Replies
May 16, 2002
I need to rotate a drag and drop object 360 degrees. I've got the drag and drop working fine, but I could only figure out how to rotate it 4 times using the set property and arrow keys on the key board. Is there another action I can use to rotate it 8 times at 45 degree angles, or will I have to use the go to action and make 8 frames for the object? I would like to be able to rotate it by pressing just one key on the key board.
View 2 Replies
Feb 14, 2012
I want to rotate 45 degrees the column label of a table.How can I do this with Actionscript or Flex?
View 2 Replies
Nov 30, 2011
How do you rotate objects 45 degrees using arrow keys for making a pacman game?
View 13 Replies
Nov 1, 2006
I have searched the forum and could not find anything specific, so if you do, please show me the link. Let me set some theoretic environment for the question. let's take a circle that is like an anolog clock but only has 8 numbers; 12 o'clock, somewhere around 1:30, 3 o'clock, 4:30, 6, and so on.
I want to have each number, a button, and when clicked will rotate to the top of the circle.NOTE this is a static image, so the numbers will upside down, etc...the do not need to stay rightside up, as they will rotate with the circle image.
Every time a number is clicked, it will rotate the circle until that number is at the top, and can move either left or right depending on which number is clicked. I thought of doing this in design time, but there are many combinations, and it would be too weighty.
I do not know how to rotate it in actionscript and then have it stop at a certain position, which I assume I could plan out in degrees, and possibly use flags to tell which had been clicked in which position,
View 3 Replies
Jul 19, 2009
I'm trying to create a navigation system that relies on the user dragging on a wheel in order to rotate it into a specific position: [URL]. The problem I have is that whenever a drag is initiated, the wheel jumps to a position where it points the zero-rotation point (indicated in the example by the red dashline) at the mouse direction. Whenever the drag is ended, the wheel stays at the position where the mouse has left it, which is correct.
However, when another drag is initiated, the same thing reoccurs - the dashed red line jumps to point towards the direction of the mouse. In short, I need the wheel to drag/rotate directly from the position where it was previously left or where it is by default. It shouldn't matter from which position the user drags the wheel. The code is located in the script of the wheel-movieClip, and is as follows:
Code:
onClipEvent (enterFrame){
this.onPress = function(){
// when the mouse presses on the wheel
this.onMouseMove = function(){
// get an angle to the mouse using atan2 (gets radians)
var angle = Math.atan2(this._parent._ymouse-this._y,this._parent._xmouse-this._x);
[Code] .....
How to implement it so that the wheel rotation is independent from the position of mouse, while it is dragged.
View 2 Replies
Jul 19, 2009
I'm trying to create a navigation system that relies on the user dragging on a wheel in order to rotate it into a specific position:
[URL]
The problem I have is that whenever a drag is initiated, the wheel jumps to a position where it points the zero-rotation point (indicated in the example by the red dashline) at the mouse direction. Whenever the drag is ended, the wheel stays at the position where the mouse has left it, which is correct. However, when another drag is initiated, the same thing reoccurs - the dashed red line jumps to point towards the direction of the mouse. In short, I need the wheel to drag/rotate directly from the position where it was previously left or where it is by default. It shouldn't matter from which position the user drags the wheel.
The code is located in the script of the wheel-movieClip, and is as follows:
ActionScript Code:
onClipEvent (enterFrame){
this.onPress = function(){
// when the mouse presses on the wheel
[code]....
I can see how lacking the code is, and I can see why it does what it does. I just can't figure out how to implement it so that the wheel rotation is independent from the position of mouse, while it is dragged.
View 5 Replies
Jun 16, 2010
So I have that panel or any other mxml component. I want somehow to rotate it around like a wheel of a car with which you drive it... loke a Racing wheel... sow like when mousebutton is down it captures pont of component... when you move mouse component rotates (not moves) according to new mouse position... How to rotate MXML component round its center like a wheel respectfully to mouse?
View 2 Replies
Sep 24, 2009
I have spent all evening trying to get actionscript 3.0 to work in flash and I'm obviously getting the fundamentals completely wrong as when I export I'll get errors all the time.I am trying to create some animation using actionscript instead of the timeline, I would resort to using AS2 which I am familiar with, but for employability's sake I want to get to grips with AS3.So I'll start with my very first problem. How on earth do I get an imported graphic to rotate indefinitely? I mean just start and keep going until i close the window without any prompt from the user.Please be thorough in your explanation as every single tut I've looked at doesn't work for me. Start with what layers need to be created, what labels should be added, instance names etc in order so I can follow it step by stepI will be making this more advanced as I go along, with easing applied to the rotation by using a button.However this is a hurdle in itself as EVERY single button tutorial I've come across just uses the button symbol instead of a Movie Clip with Actions/Behaviours which is what I want to use for more versatility.My Flash Site is looking a long way off right now, I never thought AS3 would be this difficult to use in comparison to AS2.
View 3 Replies
Aug 7, 2007
What do I do to make this rotate the line_mc move clip in a counterclockwise rotation when I scroll the mouse wheel up instead of down. Currently it rotates the movie clip in a clockwise fashion regardless of which way I scrool the mouse wheel.
[Code]...
ps. is there anyway to get this thing to ease when it rotates... instead of the jerky rotation it does now.
View 7 Replies
Jul 13, 2010
I played around quite a bit and came up with exactly the effect I was looking for. Basically a movie clip with floating icons that come in and out of the stage. All was done in actionScript 3.0 and Code Snippets. There is no timeline per se, using the classic timeline view it is only one keyframe, the animation lasts for about 45 seconds.
I want the animation to loop continueously. Even in the HTML output I did click Loop Cont. under Publish settings. That does not work either.
View 12 Replies
Oct 1, 2009
is there a way to get the animation to start for the first time from frame 1 but then loop from a different frame,,, something like frame 30.
so it starts of like normal but then the loop starts at frame 30 instead of 1.
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
Jul 17, 2010
In my original thread my answer was given and I only needed to take the information and tweak it to make it apply throughout other instances in the code.This is marked as answered. The way I constructed the code heBecause each Movie Clip is individually handled, I was explained by Ned Murphy on this forum that I need to insert code for each individual clip to send it back to start when it comes off the stage because it is structured to go to infinity with the movie symbols continuing on their path.I get that. ittle code to add was provided for an example clip that started at the top of the stage and went down, then when it goes off the stage, go back. In this case it was for MovieClip_1 (Out of 15) The red was the additional code (Provided by Ned Murphy who is IMHO a Guru here) that was added :
/* Animate Vertically*/
movieClip_15.addEventListener(Event.ENTER_FRAME, fl_AnimateVertically_13);
movieClip_15.startY = movieClip_15.y;
[code].....
View 4 Replies
Mar 22, 2010
I have created a few cool little animations with FLAR toolkit and it all works fine I am super happy with how collada files work in the AR apps that Ive made. I would like to make an animated collada file just simply loop through an animation. I am pretty sure its possible but I don't know whether the examples Ive seen use code or whether the animation is imported.
View 1 Replies
May 16, 2011
Is there an easy way to rotate an "angled" wheel/circle in flash? I played around with the 3D Rotate tool and nothing seemed to do what i wanted.
Attached is an image below that shows a quick mockup of the type of wheel I am going to use. I want to show the lines rotating around the circle.
[URL]
View 3 Replies
Apr 13, 2007
generate a random ball animation in a wheel, something like a roulette game?
View 1 Replies