ActionScript 2.0 :: Trigonometry - Finding Angle Of MovieClips With X And Y Diff
May 7, 2003
Basically I have two movie clips. I know the x diff and the y diff, now how do I find the angle at which the movie clips are at?
Code:
v MC 2
/|
/ |
/ | < y diff
/ |
MC 1 > /__|
^
angle x diff
View 10 Replies
Similar Posts:
Apr 16, 2011
I have this game where a movieclip moves towards the mouse point by finding the difference and dividing by its "speed". This isn't very good though because different users will have different cursor speeds. What I really need is a method that finds the angle between the two points then uses that angle and a "speed" to calculate the next position of the moving movieclip.Here's something along the lines of what I am looking for but it doesn't quite work?The function runs and everything. All that works, it's just the maths that isn't right.Something needs changing with the maths.
ActionScript Code:
function moveCircle(e:Event):void
{
[code]......
View 4 Replies
Nov 17, 2007
I create a line first by clicking first and a second point. Then I create a second line by clicking on the second point of the first line and second click somewhere else. Now can I find the angle between those two lines?
View 2 Replies
Jun 2, 2009
I have an object that moves to wherever the mouse is clicked, I need to be able to determine the angle at which it is moving like so
[Code]....
View 2 Replies
Oct 5, 2009
Wat's the difference between to find angles of two points which is (x1,x2) and the other point be (_xmouse,_ymouse).
To find the angles we subtract from one point to the other
like
method 1:
target x = (_xmouse - mc._x)
target y= (_ymouse - mc._y)
[Code].....
View 1 Replies
Sep 25, 2009
wat's the difference between finding a angle using Math.atan2(y,x) function and by finding using the movie clip's rotation (mc._rotation*Math.PI/180);
View 9 Replies
Nov 7, 2009
I'm trying "get" the masked objects in my MovieClip object using something like:
ActionScript Code:
for(var i:uint=0; i<myMC.numChildren; i++){
if(myMC.getChildAt(i).mask!=null){
maskedObject = myMC.getChildAt(i);
break;
}
}
It goes through myMC's children and never finds a masked object even though myMC does have a mask in it. I made myMC in flash, so is that the problem? And how would i access the masked object otherwise?
View 1 Replies
Apr 23, 2010
I am updating a file to AS3 that someone else worked on. I'm getting the error about scripts attached to buttons/movieClips and have been through the file a few times already. Is there a tool or something else that will help find the scripts?
View 3 Replies
Feb 9, 2005
Ive made this rotation with AS. But Id like to make the bar to move from angle A to angle B smoothly.
How can I do this?
View 2 Replies
Apr 22, 2004
I need some help with trigonometry in flash mx. I was inspired by this site and was wondering how you do it...go to 'images'..I dont want to just copy and paste a script you would give me..
View 1 Replies
Oct 28, 2011
From what I have gathered, _rotation uses radians?Basically, my initial goal was to make a movieclip rotate towards the mouse. I'm not very good at trigonometry.Using the help files I found atan2 which seemed to be what I needed. A little fiddling got me to this code:
var xDist:Number;
var yDist:Number;
var angle:Number;
onMouseMove = function () {
[code].....
However,the _rotation is opposite what is expected. This is not a problem as I can just flip the movieclip. But really what im here to ask is, please ecplain this code for me? I don't correctly understand how atan2 works.. and why it needs to be *60.Basically: How to get a movieclip to rotate towards the mouse.. and why does the code work, I want to learn trigonometry.
View 3 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
Jun 20, 2005
I have a button instance mc "mcBtn", inside this instance i have the actual Btn graphic symbol and AS layer.inside the AS layer i have defined onRollover, onRelease, onRollOut methods.if i rollOver/Out/Press Btn it works fine and Btn animates in some way. I needed to access mcBtn from _parent timeline AS WELL, so i defined a method mcBtn.onPress [one which is not defined inside mcBtn yet], and inside onPress told mcBtn to animate some other content....
What happened is, that onPress works fine and after pressing Btn, requested content is animated, BUT all other methods defined inside mcBtn stopped working! [no animation when rollOvered, rollOut-ed, onRelease-d]
View 3 Replies
Sep 27, 2005
Is there someone who is good at trigonometry? I have two points punkt1 and punkt2 and a line that is drawn between them. Both points is dragable. I want the line to continue after the points in both directions and with the same steep. I have counted the steep between point1 and point2 and tried to continue to drag to a point with the same steep, but it doesnt succed.
[Code]....
View 3 Replies
May 14, 2010
i have 2 movies clips 1 for navigation, 1 for pages...i cant seem to work out how to load movieclips into the other movieclip that is on the stage from the navigation clip... i know it sounds stupid and simple but only new to as3
View 1 Replies
Apr 3, 2009
I have five buttons on the stage Each of them is entirely different looking button icons..What i need is, I want to apply the same effect to different looking buttons.Swaping does not give me the desired effect.. How can this be done programatically..?
View 2 Replies
Nov 27, 2006
i want a combo box that will change the mouse to wat ever i want(run a script wit each diff selection). i know it cant be that hard i just cant get it.
View 5 Replies
Jan 19, 2009
I am facing a problem in accessing Local shared object from 2 diff. swfs. Let me explain the scenario clearly.I am developing a radio widget (in maindomain.com for ex)which has a button to open a html page (placed in contentserver.com) as a popup with specific wt and ht. The html page loads the same SWF file of radio widget from "maindomain.com", means whatever changes we do for the SWF in maindomain will be reflected automatically in the popup also.Here where the problem is:
1. Say I am playing radio station "A" in main window and added this station to favourite list (which is done by storing in Share object). So when i open the popup its reflect there.
2. Now when i change radio station "A" to "B" in the popup and added "B" to favourites and closed the popup.
3. When I refresh the main window, I can get both "A" and "B" in fav, as expected.
4. But if without refreshing in main window when I changed to some new station "C" and then open the popup, it has got only radio station "A" in the fav list.
I am pretty sure this is because of Sharedobject.flush(). The thing I am wondering is, why the station "B" which is also pushed to sharedobject when added to favourite is getting deleted when I flush() the SO.?I googled many forums but not satisfied solution for this. Even I tried to get the Sharedobject.getLocal("SO","/") every time before using data in it. but no use.Is it a Flash limitation accessing LSO from diff SWF?
View 4 Replies
Jan 29, 2006
I am thinking of having 2 diff. versions of images in an XML driven photo gallery. The flash movie is full browser (no scale) with elements that adjust to the size of the browser window. I'd like some of the images to be presented pretty large, but only if the user has enough screen resolution. If using a smaller screen, then it would display the smaller version.
Anyway to do this efficiently (yes I am prepared to upload 2 different versions of each image)? Or is this a bad idea with too much maintenance?
View 5 Replies
Jul 6, 2009
My website splash page is around 780x480 and the rest of the flash site is all 800x500. I'm not quite sure how to work this, but I want to have the splash page play automatically then go to the main page of the website. Can someone help me out with this? And does it matter that they are different sizes?
View 1 Replies
Jun 11, 2009
I seem to have an issue with a flash I have written. The person who I made it for is telling me that first time he loads the page with the Flash in it, it loads fine. However, at this point if he navigates to another portion of the site, then goes back to the Flash page, he says it freezes on the loading bar. Consistently everytime, but only on his work computer, not home computer or lap-top. I think it might be a caching issue in IE, but I am kind of stumped, anyone ever experience this?
View 9 Replies
May 29, 2011
I've got two concentric circles with their centers at (centerX,centerY). The inner circle has a radius of 100 and the outer circle has a radius of 400. If take a point on the circumference of the inner circle, I can draw a line from the center to that point. Let's call that point x1,y1). I now want to continue that radius out to the outer concentric circle and calculate the position of that outer point (x2,y2).
I'm adding a 3px 'dot' just to show where x1, y1 is on the screen. (Subquestion: I can't see it...not sure why.)This is what I'm trying:
var x1:Number = 100;
var y1:Number = 50;
var x2:Number;[code].............
View 1 Replies
May 17, 2011
I'm using Flash CS4 Pro.In Motion Editor, the way that the blur works, it allows you to blur an object on X and/or Y axis.That means you blur horizontaly or/and verticaly.I would like to make a blur motion at another angle, by example 30 degree.
View 1 Replies
Jul 1, 2011
i have a movie clip that follows my mouse to create a fading line.the thing is that i want that movie clip to change its angle according to the mouse movement.Right now the mocie clip is kind of changing its orientation but it's also gettin cray and is not fluent.heres the code of the part that draws the mouse
private function drawMouseLine(e:MouseEvent):void[code].........
View 3 Replies
Feb 21, 2011
I know a matrix [x scale, y skew, x skew, y scale, trans x, trans y], and would like to get the angle in degrees.
View 2 Replies
Oct 30, 2010
say I have two points: 0,0 & 1,-1If i were to get the angle between these, it should return 45.But the function i have created below returns -45, and If i give it the points 0,0 & 1,1 it returns 45.
ActionScript Code:
function point_direction(x1:Number, y1:Number, x2:Number, y2:Number):Number
{
[code].....
View 6 Replies
Sep 1, 2009
I have a carousel built and it works fine, but there is an angle on it that I want to get rid of. When the images move along the carousel, I want them to always stay the same on the X axis. Here is the code, I have tried mangling it in every possible combination, but it is outside my AS3 knowledge on how to get the angle changed.
import mx.utils.Delegate;
var numOfItems:Number;
var radiusX:Number = 1150;
var radiusY:Number = 50;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 6;
var speed:Number = 0.002;
[Code] .....
View 1 Replies
Apr 18, 2009
how to get angle of mouse its very simple.use this Script (copy and past in your file). A sample file which runs only on CS4 is attached.
//Start............................................. .................................................. .................
// Make a line (o-----------------------) and take its left side as center named 'mcArrow'
mcArrow._x = mcArrow._y =200;
[code]....
View 1 Replies
Oct 27, 2009
I'm at a bit of a coders block, and I'm sure it's quite simple. I tried using the following:Code:((angle-180)%360) + 180But for angles < 180 degrees, it works just fine, but after that it get's a little funny. I know why it's doing that, I'm just looking for a way to fix it.
View 2 Replies
Feb 5, 2009
take that same input text box and rotate it on an angle. preview. my type cursor shows up over it but it won't let me type anything int he box (or it if it typing, it's not showing up... which is half of the point).
View 5 Replies