ActionScript 2.0 :: Drag / Rotate Functionality For Navigation Wheel?
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.
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.
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,
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);
I have been asked to create a wheel for navigation similar to on the Visit Provence website. However, I don't know where to start and my Googling effort have been unsuccessful - I guess that I am searching using the wrong terms. It the the way that the wheel moves and interacts with the other segments around it that interests me.
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?
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.
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.
I have been asked to create a wheel for navigation similar to on the Visit Provence website. However, I don't know where to start and my Googling effort have been unsuccessful - I guess that I am searching using the wrong terms.It the the way that the wheel moves and interacts with the other segments around it that interests me.
I have researched all over and have found some that "kind of" work, but the coding always has issues with CS3 (my version). I am more proficient in AS2, but would be willing to try AS3 if that is the way to go.I need a script that will allow the user to use their mouse to drag a wheel that will slow down to a stop. Think "Wheel of Fortune" style. Where it stops will trigger an event.
[code]I want a tree in this structure, having line between the nodes, also, instead of Open and Close Folders, I have added my own graphic there with label. I did by extending TreeItemRenderer Class. Now, I if iam dragging and dropping a child node ex:label5, and try i drop it above label1 here, it is getting dropped there. i.e.,it is becoming like.[code]
How can i implement drag drop functionality in Component 1 Flex grid. Also the grid should allow some functionalities related to dragged data like Allow deletion of dragged data in cells of Grid.Dragged item remains in original cell as well and in the cell where it is dragged to.If the original item is deleted, the dragged item also gets deleted.Grid should not allow data to be duplicated in same column.how is it possible in flex grid. It is a windows based application. So if any possibility of doing the same using windows application basic functionality.
i am designing a program using drag and drop functionality.i created three movie clips i.e circle_mc ,square_mc and triangle_mc.here circle is source and square is target if "circle_mc" is dragged and dropped on the "square_mc" then the "triangle_mc" should rotate 90degrees(clock wise). and if the "circle_mc" is removed from "square_mc" then the triangle should rotate 90degrees(anti clock wise).
I am developing a drag and drop functionality and take a JPEG screen shot of droped objects. my problem is. when i drag and drop an object the object jumps off some distance.. i am unable to clear tat..
Everything seems to work correctly locally, until I upload it to the test server. The SWF will connect to the database, but it won't load the images, and the drag and drop functionality messed up.
In my Flash File I have a wheel. The user is able to rotate the wheel by using arrows to jump to the next "segment" (think 20 images attached to each other forming the circumference of the wheel).
[Code]...
However, what I want to be able to do is, click and drag to spin the wheel, complete with acceleration and deceleration and even settling on the nearest image when the wheel reduces to a certain speed. I have no idea how to go about doing this: I'll need to kinda detect a before and after position of the cursor and translate this into a speed for the wheel which then decelerates over time and also detect which image is closest at a certain speed and "snap" it, both scrolling up and down. (it'll only affect the Y-axis)
I have a circle movieclip that needs to rotate to certain destinations depending on buttons pressed in the navigation. Everything works fine, except when you go from green to cyan and vice versa, it does a full 360 rotation instead of just moving to the destination.
I am having problems with this Flash movie of an draggable, rotatable XML blog. I have got the XML stuff working OK. I'm just having problems making the drag-to-rotate thing work. I want it to be able to be moved around the page like a piece of paper and rotated such.
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
I am trying to create a drag and throw effect I have most of the effect working correctly but I am wondering how to only move one item at a time and have that thrown unaffected til the friction brings the item to a stop. what happens currently is if an mc is moving and you select another it moves both items.
Code: var mx0; // Previous Mouse X Position var my0; // Previous Mouse Y Position var velocityX = 0; // Velocity in X Direction[code]...................
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.
I've recently downloaded a great gallery from FFILES.COM. Here's the link: [URL]
I want to add in a menu bar at the bottom of the gallery. Meaning to say, all the photos that load up from the XML will be behind the menu bar. I tried with creating a new layer on top of every other things (inserted a rectangle box for testing), but the photos for the gallery comes infront of my rectangle box.
Basically what I am trying to do is have my movie clip rotate/pivot when I press on it, same as the arm on the record player of this [URL]. At the moment, the movie clip rotates according to mouse follow, but I would like to click, drag and rotate so it pivots from one point.
Code: const TO_DEGREE:Number = 180/Math.PI; addEventListener(Event.ENTER_FRAME, rotateObject); var maxRotSpeed:Number = 5; var rotScale:Number = 0.2; function rotateObject(e:Event):void { [Code] .....
I'm trying to drag & rotate a planet so it spins around with the mouse -instance name: PlayerThe code works really well but it doesn't seem to rotate around the centre, instead it rotates from the top left corner.I'm quite a noob at as3 so I'm not quite sure where I've gone wrong with my code to be able to fix this. Do I need to specify the dimensions of the stage or the planet? I have altered the Stage from the the default 550 x 400 (if this could be the problem).
Been working on this for days and can't quite get it. Place a standard playing card or something similar on your desk in front of you. Lightly press your finger onto a random point on that card and drag it around your desk. See how it rotates towards the direction you are moving and such? I want to simulate that behavior.
i have some script that creates a rotating video wall/carousel effect that rotates left and right depending on where the mouse is.I want the carousel to only rotate when the mouse is down and dragging - but just can't seem to work out what i need to change.how do I define the drag action instead of the current +x & -x co-ordinates?here is the full script for the entire carousel
I want to add in a menu bar at the bottom of the gallery. Meaning to say, all the photos that load up from the XML will be behind the menu bar. I tried with creating a new layer on top of every other things (inserted a rectangle box for testing), but the photos for the gallery comes infront of my rectangle box.