ActionScript 2.0 :: Rotating While Following "dragging"?

Oct 3, 2007

is what I want to do:- the game consists of a "ship", which is supposed to move across a maze to reach a goal area, without touching the walls;- when the game starts, the user clicks at the ship and it begins to follow the mouse position every time the mouse moves (much like a drag). Just this:

PHP Code:
this._x = this._parent._xmouse;this._y = this._parent._ymouse; 

- so far, so goog. But it also has to rotate to the direction its moving. After some hours of tries, the best I could achieve was this:

View 4 Replies


Similar Posts:


IDE :: Dragging Objects - Rotating And Easing

Aug 22, 2009

I have two drag-related questions. The first one is how to rotate an object by clicking and holding on it, then moving the mouse round in circles. Think of a clock face, and the user clicking and holding on one of the hands, then spinning it around. The centre point would be the part of the hand that's attached to the middle of the clock face, and the other end of the hand would be able to rotate 360 degrees around the face.

The second one (and not related to the first one, a separate query altogether) is how to drag something horizontally along the screen, but have it stuck at a certain speed. So if the user tries to quickly drag the clip from left to right, it will not reach the right instantly, but instead follow the cursor at a slow speed.

View 1 Replies

ActionScript 2.0 :: Rotating / Dragging Objects Based On Keypress

Jul 22, 2002

I have a bunch of draggable objects and I want to be able to rotate them. Is it best (possible?) to rotate them based on keypress or how might you go about this. Here is my keypress code so far ( draggin works - rotate doesn't )

[Code]...

View 5 Replies

Flash :: IDE :: Rotating Object Either Mouse Movement Or Dragging By The User

Apr 24, 2011

Im in my final year of year 12 and need to have a car rotate in flash by either mouse movement or dragging by the user. Ive tried googling and being lower then noob level on adobe flash I have no idea about anything. I have created a car model in 3ds max. It is of high detail and I wanted to keep it that way. An example of what I wanted to create would be [URL]

View 1 Replies

ActionScript 2.0 :: Rotating Menu With Non-Rotating Labels?

Nov 1, 2005

I have a rotating menu that sets the selected button to the 3:00 position once clicked. I need the labels for the buttons to stay in the upright position as they rotate with the button. I have attached an image. Anyone know of an action script that would keep the labels upright?

View 8 Replies

ActionScript 3.0 :: Get Name Of Mc Mouse Is Over When Dragging An Other?

Jul 17, 2009

I want to if I can set a variable with the mc's name that the mc I'm dragging around hits.I did this before with eval() in as2 but there is not such a thing anymore. [code]...

View 4 Replies

Professional :: Dragging Stage (several Mc's)?

Feb 15, 2010

I am looking for a way to "drag" several movieclips at a time and thereby create a panning effect on the entire stage. The movieclips are supposed to follow the cursor (a mask) on the X axis.

View 9 Replies

DragStop Won't Stop Dragging

Dec 11, 2009

I have the following code:

Code:

lights1.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
lights1.addEventListener(MouseEvent.MOUSE_UP, dropIt);
lights1.buttonMode = true;

[code]...

I can start dragging the symbol no problem but no amount of clicking will get it to stop. Am I doing something wrong? Using Flash CS4 with ActionScript 3.

View 1 Replies

Dragging Components In Flex?

Apr 3, 2010

so I am trying to drag around some images in a canvas. I am adding eventlisteners to the components and calling startDrag() and stopDrag() to pick them up and stuff:

component.addEventListener(MouseEvent.MOUSE_DOWN, component.startDrag)

The problem is that it is selecting the image at its (0,0) location and not where I initially click on it. So there's a sudden "jump" when I click on the image. It is not smooth.

I noticed that startDrag() has two default parameters, one of them is lockCenter and it is default to false. Maybe do I set it equal to true somehow? (I don't know how to pass arguments to my second parameter in addeventlistener)

Another question: if I want to add more conditions to it, like make a new function that uses component.startDrag(), how do I pass the component to this function while adding event listener to it at the same time? for example: I want to do:

component.addEventListener(MouseEvent.MOUSE_DOWN, some_other_function);

where some_other_function uses component.startDrag();

View 2 Replies

Flash :: Dragging On Different Levels?

Apr 26, 2010

I have a flash project with three non overlapping panels (visual spaces) each of which contains different movie-clips. Each movie-clip in a particular panel is the child of that panel.Now, I want to drag one of the movie-clips from one panel to another (remove it as a child from the first panel and add it to the other) without a jitter and proper drag.What is the appropriate way to handle the drag architecturally

View 1 Replies

ActionScript 3.0 :: Dragging Only X And Y Direction?

Feb 4, 2010

i am developing a flash game where i need to drag movie clips but i have to allow dragging only two direction x and y.

View 1 Replies

ActionScript 2.0 :: Dragging Several Objects At Once

Mar 20, 2011

The code for dragging an object with the mouse is known:

mc.onPress=function(){this.startDrag(false);};
mc.onMouseUp=stopDrag;

I tried to drag two objects at a time using

mc.onPress=function(){this.startDrag(false);mc2.st artDrag(false);};
mc.onMouseUp=function(){this.stopDrag();mc2.stopDr ag();}

But this seems to drag only the object, corresponding to the last parameter in the function

How shall I drag more than one object at a time?

View 7 Replies

ActionScript 3.0 :: Mouse_Up/Down Dragging?

May 12, 2011

I've got a MovieClip that I want to drag around the stage, but only whilst the mouse button is held.

I've got this code:

[Code]...

View 1 Replies

ActionScript 2.0 :: Dragging MC Out Of Scrollpane

Feb 29, 2012

I can't seem to drag a movie clip out of my scrollpane. It works fine inside the pane, but it won't show when I drag it out!

View 2 Replies

ActionScript 2.0 :: Dragging Scroller Bar Up And Down Accordingly

Dec 2, 2002

I'm messing around with a text box scroller. I want to be able to click on the scroller bar and drag it up and down accordingly.

Here is the code I am using:
on (press) {
startDrag ("_root.scroller", false, 578, 35, 578, 163);
} on (release) {
stopDrag ();
}

View 5 Replies

ActionScript 2.0 :: Dragging More Than 1 MovieClip?

Dec 7, 2003

How do I drag more the 1 movieClip using this

on (press) {
startDrag(screen);
}
on (release) {
stopDrag();
}

View 3 Replies

ActionScript 2.0 :: Dragging Up And Down Or Left To Right Only

Apr 6, 2008

I have a movieclip in the centre of a cross and want to make it move only along the lines of that cross. Is this possible with startDrag or do I need more complicated method? To illustrate: If you've moved left or right, you can't move up or down and vice versa.

View 2 Replies

IDE :: Dragging Multiple Objects In As3

Feb 15, 2010

I have need to simultaneously move a slider (called "shadeGrabber") movie clip and a mask. I'd like to do this by dragging the slider and seeing the mask move with it.

The example movie clip on the left (called "PICTURE_WIPE") is what I'm going for, but interactive instead. I'm working in the movie clip on the right (called "PICTURE_WIPE copy 2")

Here's my code, for quick reference (found on the "AS" in the "PICTURE_WIPE copy 2" movie clip:

[Code]....

View 4 Replies

ActionScript 2.0 :: Dragging More Than 1 MovieClips?

Dec 7, 2003

How do I drag more the 1 movieClip using this

on (press) {
startDrag(screen);
}

[Code]....

View 3 Replies

ActionScript 3.0 :: Dragging The Entire Screen?

Feb 22, 2009

I'm trying to get objects to drag and drop. Instead of dragging just the circle, it drags the entire screen. I can get it to work if I use "this.circle.startDrag()" but I want to be able to use the startMove and stopMove functions on different children, text boxes and other objects generically. Here's the code:

circle.addEventListener(MouseEvent.MOUSE_DOWN, startMove);
circle.addEventListener(MouseEvent.MOUSE_UP, stopMove);
function startMove(event:MouseEvent):void {

[code].....

View 2 Replies

ActionScript 2.0 :: MX - Dragging Zooming Locking A MC?

Aug 19, 2009

Being adventurous I've got (all built in AS1) a masked area that you can view an image in. I'm trying to make it so you can zoom it in and drag it around, within the masked area, but the dragging locks it so that you can't drag it to the point where it leaves the edge of the masked area - if you follow. So when you're zoomed in, the iamge is never allowed to be dragged off so far that it's not filling the masked area. I've tried all sorts of code and the following code seemed to work well

Code:
// imageMC = the clip being scaled/repositioned/dragged
limitLeft = 0-Math.round(imageMC._width-maskWidth);
limitUp = 0-Math.round(imageMC._height-maskHeight);
limitRight = 0;
limitDown = 0;
imageMC.startDrag(false,limitLeft,limitUp,limitRight,limitDown);

But since the border size around the image is adjustable (it could be 2, it could be 20) and that eats into the area used to show the image (eg image is offset by imgBorderSize and shrunk by imgBorderSize*2) I tried to factor that into the formulas because once I turned the borders up the above formulas wasn't working right anymore

Code:
// imageMC = the clip being scaled/repositioned/dragged
limitLeft = 0-Math.round(imageMC._width-maskWidth)-(imgBorderSize*2);
limitUp = 0-Math.round(imageMC._height-maskHeight)-(imgBorderSize*2);

[code]....

I also tried to make it so when you zoom in, it zoomed in on the center of the area you can see through the mask, not on the top left - so repositioning is occuring alongside the scaling for the zoom to try and acheive that. Nothing clever, just :

Code:
// ZoomCalc range = 0-100;
// imageMC = the clip being scaled/repositioned/dragged
imageMC._xscale = 100+(2*ZoomCalc); // 100% - 300%

[code]....

When it zooms out however it'd be nice if it didn't snap back to center via the above code, eg if yu're zoomed into bottom left it would stay viewing bottom left as it zoomed out - yeah?If anyone has ANY input to this I'd greatfuly welcome it :/ If I manage to get it working then I have to figure out what my layer above all these layers with clickable buttons don't work as soon as I implemented the dragging of the image layer Is there no way to have buttons on something that is being dragged? ((

View 2 Replies

Make Item Disappear After Dragging It?

Sep 7, 2009

I basically am suppose to make "scarf" drag over to a movie clip named "winter_mc" and when it is on it, it is suppose to disappear but it's not disappearing. Here is my code used in the scarf:

Code:
on (press) {
startDrag(scarf, true);
}

[code]....

View 5 Replies

ActionScript 3.0 :: Stop Both Objects From Dragging?

Jun 11, 2010

I've been searching various sites and forums for a solution to this, but have so far found none, so I was hoping to ask for some advice on the subject.Basically I have a movieclip of a photoframe, and I'd like it so when the user clicks the edge of the frame, they can drag it around, while clicking the photo inside the frame will open a new window and show the photo in full view.Originally I thought I could accomplish this simply by using:(Note: Framemc is the main movieclip, with another mc called "Photo" inside which is the picture)[code]But this leads to an odd problem: When dragging the frame it works fine, but the user can also drag the "photomc" around too (like, the frame stays in place and doesnt move with it), thus removing it from the frame.Is there a way to tell the code to move only certain parts of the mc and not others?

View 1 Replies

ActionScript 3.0 :: Math For Rotated Dragging?

Aug 17, 2010

this math isn't working well. I'm using it for a rotated drag and drop (of a tone arm on a vinyl, a kind of abstract turntable simulation). Right now it just moves a bit in the middle of the vinyl (values between 21 and 36, is this degree or what unit is this?), but it should move between the two edges. The problem is that I don't know enough about trigonometry functions. Therefore I can't optimize the math for envisaged behaviour. Does anybody have an idea/tip how I can get a bit more control on the math and its effect? (maybe with more trace functions)

[Code]...

View 1 Replies

Drag & Drop WITH Keystrokes While Dragging

Sep 26, 2009

Is it possible to handle keystrokes WHILE dragging? I found this to be impossible, because hitting a key always fires an "onRelease" or "onReleaseOutside" event on the dragged movieclip when releasing the key - intterupting the drag operation. What I want to do is something like this: Drag and Drop a Movieclip and while dragging it I want to be able to flip it with a keystroke.

[Code]...

View 2 Replies

ActionScript 3.0 :: Dragging With Inertia For Dummies?

Jul 1, 2010

I'm trying to achieve a fairly simple effect--a dragging a MC with inertia.
 
Specifically, I'm trying to get this to happen:
 
1. When you click with the mouse on the MC (not the entire stage), the MC gets dragged along.
 
2. When you let go of the mouse button, the MC keeps going with inertia (slowly comes to a stop) that depends on the speed with which the MC was dragged and in the same direction. The MC shouldn't change directions if the unpressed mouse is moved around.
 
3. The dragging is constricted to the X axis.

View 3 Replies

ActionScript 3.0 :: Dragging A MovieClip Vertically?

Oct 28, 2010

I'm trying to enable the user to drag a movieclip vertically. I've coded something to be dragged horizontally, and thought it would be a simple matter of swapping some of the info around.

Here is my current code:

stop(); 
var leftY1:int = 120;
var rightY1:int = 400; 
frontbar1_mc.mask = mask1_mc.rec1_mc;

[code]....

Now when the movieclip is clicked, it completely changes position and will only be dragged horizontally. Then when its clicked again, it will jump vertically by how much I previously dragged it horizontally.

View 3 Replies

ActionScript 3.0 :: Dragging Movieclips And Getting Info From Them?

Feb 3, 2011

I've been doing a game that requires to drag some pictures into containers... that's all great.... but at the same time, I have to be able to obtain info from them (a pop up) when i click them.I've tried using CLICK and MOUSE_DOWN on the EventListeners, but everytime I drag the object, when I release it, the pop up shows.

View 5 Replies

ActionScript 3.0 :: Release Outside When Dragging Object?

Jul 27, 2011

I have a number of tabs which can be dragged around the screen.. I've constrained the movement to a rectangle using startDrag(false, rectangleName) but when I ROLL_OUT or MOUSE_UP outside of the constrain rectangle the tab does not register it, thus defining itself a new startX and startY once clcked on a second time..

private function tabOver(event:MouseEvent):void { event.currentTarget.scaleX = 1.05;  event.currentTarget.scaleY = 1.05;}private function tabClick(event:MouseEvent):void { event.currentTarget.scaleX = 1.05; 

[code].....

View 7 Replies

Flex :: Dragging A Image Within A Loader?

Mar 23, 2010

I am having trouble in dragging a image within a loader. I am able to do zooming and rotating image but not moving image with mouse. Purpose is when I zoom a image info is out of boundaries and so is hidden. To see that info users should be able to drag the image any way they want.

View 1 Replies







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