ActionScript 2.0 :: Rotate Towards Mouse With Boundaries And Reflection?
Oct 20, 2003
I'm using the code 'rotate towards the mouse' from [URL]
It works fine to rotate the clip, but there's two things I'd like to have happen here:
1. At a certain angle of rotation, the MC that is following the mouse reflects horizontally. example: a profile of a head is following the mouse. i don't want the head to be upside down when the mouse reaches the back of the head, but rather the head flips over to watch the mouse.
2. Boundaries: is there some way to set up the code so that the MC stops following the mouse when it reaches a certain position on the Y-axis?
I'm using Flash MX or MX 2k4, whichever is more convenient for this project.
View 3 Replies
Similar Posts:
Oct 20, 2003
I'm using the code 'rotate towards the mouse' from [URL].. It works fine to rotate the clip, but there's two things I'd like to have happen here: 1. At a certain angle of rotation, the MC that is following the mouse reflects horizontally. example: a profile of a head is following the mouse. i don't want the head to be upside down when the mouse reaches the back of the head, but rather the head flips over to watch the mouse.
2. Boundaries: is there some way to set up the code so that the MC stops following the mouse when it reaches a certain position on the Y-axis?
View 3 Replies
Mar 30, 2011
The idea is I have 3x3 containers(Sprites) - each one holds 2 tiles of 2 two images (shown one and unvisible - laying behind) . So there are 9containers and 18 tiles. When I click on the image I get rotation of the containers, and when every container is about 90 degrees, its childs swap each oher. So in result I get second image shown. But unfortunely then, shown image is rotated by 180 degrees, that means its left side is on the right. Pre rotating containers ( of tiles gives total mess, as middle tiles seem to be right, but left side of the image and right doesnt match to rest.So I need to rotate tiles, which are bitmapData - parts of Bitmap. But I can not rotate them - there is no property .rotationY for bitmapData, and I can not use matrix's rotate() method as it traits only angle rotation and not axis rotation.If I rotate by Y axis the bitmap before slicing it to tiles nothing happens, so I guess draw method relies on default Bitmap.
So Q : How can I rotate on Y axis a bitmap to have mirror reflection of the image and then apply it reflected to the as a .bitmapData property and slice it to small pieces.
View 0 Replies
Mar 20, 2004
I'm working on a new site: [URL]. However, I've got some problems with my reflection of the mouse-pointer. The problem is that I don't know how to create the fake 3D effect, because now when you move your mouse over "Identity" the reflection is above the real mouse. I was thinking to put a mask, so the reflection cannot go above the real mouse, but then there is no reflection.
View 14 Replies
Mar 6, 2009
i've added this reflection class [URL] to this simple .fla file, but i can't see any reflection [URL]
View 2 Replies
Jun 1, 2010
I can't find any info on this so I guess I'll just ask. I'm trying to make moveclips that will follow the mouse pointer on MOUSE_OVER but only up to a certain distance then tween back to its original coordinates (preferably with a bounce or elastic ease).I tried startDrag(); on mouse over and that works quit cool but the problem is stopping the drag...
View 5 Replies
May 14, 2005
Not sure how to explain this, but I have a horizontal menu, and a small image above it that follows the mouse, within it's set boundaries. The only thing I have trouble with is getting it to stop right above the button when it's clicked, and wait for the user to move over the navigation menu again before it starts following the mouse... So, when a user clicks on a button, the image should stick there. I had the idea to have a transparent area above the nav that would detect for the mouse? Because right now, your mouse can be anywhere on the page, and this image scrolls right or left. How to set that up?
Here is the code I have on my image mc (called 'niteLite')... it's in the root (my navigation is in another mc though - couldn't get the mouse follower to work right within another mc, unfortunately)... On niteLite (image mc)
Code:
onClipEvent (load) {
_x = 347;
_y = 497;
speed = 2;
} onClipEvent (enterFrame) {
[Code] .....
View 2 Replies
Sep 25, 2009
I'm stuck trying to define the y mouse position inside a mask.How does one set boundaries in which to find a mouse position?
View 1 Replies
Mar 19, 2012
So this one is a tricky one (for me) vital to the development of my project due to the fact that we can't directly modify the position of mouseX and mouseY - they are read-only variables. Basically, what I want to do is have a player able to move their mouse only within a certain triangular area when a specific instance is active. The latter bit I can manage just fine, however I am having trouble restricting mouse movement -- or apparent mouse movement.
Here's what I have done so far:
1. Assign a library moveclip to the mouseX and mouseY position in the Event.ENTER_FRAME event - although I acknowledge that this should be moved to Mouse.MOUSE_MOVE. (this does not matter yet)
2. Using Corey O'Neils Collision detection kit, do a hit test on the border instances of the area with the crosshair/cursor.
3. Offset the cursor appropriately, and then set a standard Boolean value to false so that the cursor will not keep bouncing back into the cursor over and over.
My problem is, I am not sure what the best way is to go about allowing mouse movement again. For what it's worth, this is to stop users from aiming in an unrealistic direction with a character in a top-down (ish) shooter.
Here is my code regarding mouse movement thus far:
import flash.ui.Mouse;
import flash.events.event
import com.coreyoneil.collision.CollisionList;
Mouse.hide();
var c:crosshair = new crosshair();
addchild(c);
var myCollisionList:CollisionList;
myCollisionList = new CollisionList(c);
[Code] .....
View 2 Replies
Sep 4, 2004
Does anyone know how to set boundaries on a slow chase mouse follower. Attached is the fla im trying to set boundries to. The ball should not go past the red lines.
I have used the following code:
Code:
onClipEvent (load) {
_y = 0;
speed = 5;
[Code]....
View 2 Replies
Mar 30, 2009
How would you force a mouse follow movieclip to snap to a x y position if it reaches x y boundaries or perhaps if a button is released the movie clip snaps to a x y position? Of course if the mouse returns to x y boundaries I'd like for the movie clip to follow again.
Right now this is the code I'm using to make the movieclip follow the mouse within x y boundaries:
Code:
onClipEvent (load) {
_x = 0;
_y = 0;
[code]....
View 4 Replies
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.
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
Jun 21, 2010
I am wondering how I can make a top viewed char, that is rotating after my mouse. With an enter frame function or something?
View 1 Replies
Oct 14, 2010
I am having problems finding a way to rotate an object with mouse movement when the mouse is down, and stop the rotation when the mouse is released.
I can do drag and drop ok but this doesn't help at all.
View 3 Replies
Nov 26, 2010
I made a game in AS2 where the player rotates towards the mouse, then discovered you need AS3 for 3D things(which I plan to add later) so I re-made the game in AS3. I think I can more or less do the rest of it but the rotation is driving me crazy. This code works fine in AS2 but when I try it in AS3 it completely fails. The player just wobbles about a 90 degree radius.
[Code]....
View 1 Replies
Oct 29, 2009
I'm using the following code to rotate a MC on the Y axis that stops at a certain point. Is there any way to do the same using the tween class so it has a softer finish.
addEventListener(Event.ENTER_FRAME, mcRotation);
function mcRotation(event:Event):void
{
var controller:Number = mouseX - stage.stageWidth * 0.5
[Code].....
View 1 Replies
Sep 27, 2010
I'm trying to achieve the effect found on this site:As you can see, the cursor (the marker) slowly rotates, based on the Y value of the mouse
View 1 Replies
Feb 11, 2012
I am horrible at maths and I would like to ask how to make an object ex. an arrow turn into direction of the mouse?ENTER_FRAME and some mathematical functions, but I cant tell which and how to use them.
View 2 Replies
Apr 12, 2006
i'm trying to build a "circular" menu that rotate on rollover and mouse move but with no good results. Just something like the yugo sliding menu but with buttons placed around a circonference.I don't need a dinamic menuI need a function that let the menu rotate up when cursor is below the half of the circle and viceversa.I've done a search and found a compass example but i really can't edit it. I'm a newbee and can't really figure out how to rotate a movie clip around its own axes on mouse move..
View 4 Replies
Nov 6, 2009
I am trying to rotate a sphere with the mouse on the x and y axis but the sphere keeps 'roll'ing and flipping it all around.
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
[code]....
View 1 Replies
Jul 17, 2011
I want to rotate a movie clip with the mouse and I have this code:[code]Neither looks like what I want. The first image is okay until its rotated, and the second is blurry but looks better than the first when its rotating.So I have two questions.Is there a way to get better image quality when my image is rotating with out using a bitmap?Can some one give me a code example that changes the frame in the symbol based on the position of the cursor to the symbol?
View 1 Replies
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
Dec 20, 2005
i know how to check the angle between my object and the mouse, but i dont know how to make it rotate slowly to it...
i tried this codes:
Code:
//first method:
onClipEvent (enterFrame) {
this._rotation = (Math.atan2(_root._ymouse-this._y, _root._xmouse-
[Code]....
View 9 Replies
Apr 20, 2006
I have a mc that I want to continously rotate, I want it to rotate in whatever direction the mouse is from the center of the mc. If the user pulls the mouse out I would like for it to speed up and slow down accordingly.If this is not possible, I wouldnt cry. Any way when the user goes over a desiginated area I would like for the motion to stop until they pull away again.How would I go about doing this.I've seen this thread but don't understand where to attach the script, and I also need the stopping script
View 1 Replies
Apr 29, 2003
I want a ship or something in the center of the stage and to be able to click and the thing will shoot at the mouse. I know how to get it to shoot at the angle. I just don't know how to get the rotation with the mouse. I can do it with keys but not with the mouse. What I need object rotates pointing to mouse...
View 2 Replies
Jan 22, 2008
I have attached my fla. I want rotate the mc by Mouse drag. But its get some of the jerk.
View 1 Replies
Feb 24, 2009
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
Code:
*/
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
[code]....
View 4 Replies
Apr 2, 2009
I have a 40 frame animation that in sequence rotates an image. That I need to add a mouse drag function so I can scrub through the images like here
http:[url].....
View 1 Replies
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
Oct 24, 2010
I'm trying to get a MC to rotate to face the mouse using tween:
Code:
import flash.events.MouseEvent;
import fl.transitions.Tween;
stage.addEventListener(MouseEvent.CLICK,clicks);
var tween:Tween;
function clicks(e:MouseEvent):void {
var dx:Number = mouseX-mc.x;
var dy:Number = mouseY-mc.y;
var angle:Number = Math.atan2(dy,dx)*180/Math.PI+90;
tween = new Tween(mc,"rotation",null,mc.rotation,angle,5);
}
While this works fine, there are certain clicks which make the MC pick the longer route to rotate.
View 2 Replies