ActionScript 3.0 :: Using Geolocation To Find Distance Traveled?
Feb 23, 2012How can i use Geo location to find the distance traveled? Im trying to develop this iphone app but i cant figure it out
View 2 RepliesHow can i use Geo location to find the distance traveled? Im trying to develop this iphone app but i cant figure it out
View 2 RepliesI am rotating an object with TweenLite, however instead of a set duration I want the duration to be based upon the distance of rotation where 180 degrees = 3 seconds 90 = 1.5 and so on. Here is my attempt to find the distance of rotation:
var time:Number = Math.abs(Math.atan2(Math.sin(angle-wheelObj.rotation),Math.cos(angle-wheelObj.rotation));
TweenLite.to(wheelObj, time, {shortRotation:{rotation:angle}, ease:Expo.easeOut, onComplete:rotateWheel, onCompleteParams:[target]});
TweenLite.to(carObj, time, {shortRotation:{rotation:angle}, ease:Expo.easeOut});
This just isn't working, time is sometimes huge when the rotation is small and sometimes tiny when it is big, so does anyone know a better way to do this?
This code calculates the distance between 2 points by using distance formula, Math.sqrt ( (x1 - x2)^2 + (y1 - y2) ^2). My first point has mmx and mmy coordination and second one has ox and oy coordination. My question is simple, is there any FASTER way for calculate this?
[Code]...
How could I find the distance between a given point and a drawn line? I was thinking about using the point-slope formula to draw a perpendicular line between the point and the line and measuring it as the distance, but I'm not quite sure how to do this in as3.
View 0 RepliesHow does Flash use Math.sqrt to get the distance between 2 movieclips? In the example the only givens are 2 points along a triangle:
function getDistance(x1:Number,y1:Number,x2:Number,y2:Numbe r):Number {
var dx:Number=x1-x2;
var dy:Number=y1-y2;
return Math.sqrt(dx*dx+dy*dy);
}
dx is the difference between the x coordinates of 2 points/2 mc's
dy is the difference between the y coordinates of the same 2 points
the Math.sqrt is the Pythagorean theorum
If the Pythagorean theorum is a^2+b^2=c^2 for the sides of a triangle how do 2 points achieve the same result if the lengths of the sides aren't given?
I created a movie where I have a circle in the middle and a line drawing from the center out when the mouse moves. I want to calculate the distance from the mouse position to the middle of the circle. What I am going to do is have a sound playing from the center of the ball..The closer you get the louder the sound gets and the further away from the middle the quieter it gets. You can download my fla to see what I have so far.
View 1 RepliesIs there a way to find the radial distance using the zipcode? My task is to search the all the users residing with in a specified distance. I know the zipcodes of the users. Eg, users between 25 miles from the current location. I have other search categories, for which i am using mysql queries. I am unable to figure anything out for the distance issue.
My backend is in php
and frontend in Flex.
The best option for me would be something like that of www.zip-codes.com/zip-code-radius-finder.asp. ie, if I should be able to get all the zip-codes available in the specified radial distance. So i can compare this zip-codes to the users zip-codes in my database. And select the ones with a match.
So, right now when I want to find the distance between two points, I go: dist = Math.sqrt((this_x-that_x)*(this_x-that_x)+(this_y-that_y)*(this_y-that_y)) BLECH! I don't want to do that every time. So I want to make a nice little function that I can apply to an object. Problem is, I don't know how to do this. Is it possible to end up with something as easy as: Math.dist(thisclipname, thatclipname)? How do you guys set up functions that do bulky math and return nice clean numbers?
View 4 RepliesI am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.
View 1 RepliesI am posting my code that attaches the movieclips on stage
[Code]...
i was hoping that when the newMc expands, all other mc would keep the same distance between each other as at initialisation. I not able to figure how to do it. maybe even an earlier post or llink where similar query was explained.
In AS3 I am trying to get the distance between 2 3D objects by using distance method.
if(Vector3D.distance(model.position,model2.position) < 100)
{
// do something
[Code]....
>>You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.
Which point does this method pick? Is it the closest point to the other object ?
I am just thinking of how much time this would take in testing objects with large poly count.
I'm trying to use the geolocation framework in my flex website to determine the position of the user. I researched it and it seems a fairly easy way to do this by using the as3 framework geolocation. But I'm facing the following problem. When instantiating the mxml where i have: import flash.sensors.GeoLocation; (i can use intellisense the complete this!) private var geoLocation:GeoLocation;
It gives an error it cant find the class flash.sensors::Geolocation. It should be in the playerglobal.swc that can be found under ./Adobe Flash Builder 4.5sdks4.5.1frameworkslibsplayer10.2. I've decompiled this swc and can see in the xml file that the method is there(as you can see below)
[Code]....
I am trying to make a flash movie display the Geo-location of the user (city and state), just like those JavaScripts that you see everywhere that say something like: "welcome to my page, from CITY NAME, STATE NAME."
After much searching, I believe that I may have found a solution, but I do not know how to implement it. It requires the use of a ".as" file, which I have no idea what to do with. Here is where I am at:
I am not allowed to post URLs, but you can google the phrase "flash geoip javascript" and it's the first link. -MaxMind GS WebService
That URL shows the javascripts to use (which are easy enough to implement by themselves), but at the very bottom of that page is a link to an "ActionScript wrapper" which allegedly facilitates usage with Flash. I just don't know what do with with the "ActionScript wrapper" or where to go from here.
I created a button that looks up the coordinates of the device. There is no errors in the code but for some reason which is eluding me, the event is not being triggered.
Here is my code:
protected function lblCheckIn_clickHandler(event:MouseEvent):void
{
if (Geolocation.isSupported)
[Code]....
I'm trying to pass the geolocation over Javascript to Flash. The .SWF is embedded in a HTML site and set to AllowScriptAccess="always". For some reason the getGEO() function is not receiving the call.
[Code]...
I must rejected all users outside Denmark from our live streaming (c-ip) and this is done in an access plug-insBut now I need to open up one of the streams, but I can't get the streaming name in the access-plug-ins only in the Auth-plug-ins.I cant use x-page-url or s-uri I need pStreamName. in access-plug-in like thissetStringField(m_pAev, IFmsAuthEvent::F_STREAM_NAME, pStreamName);but I cant get it inside the access-plug-in
View 1 RepliesCan't figure out this. I have 3 points A(305,108),B(311,119) and C(348,172), to find out the distance from B to AC, i use a method found here [URL]..
I then got the distance equals to 131. When I draw AC and B, it appears B is almost on the line (distance <= 1). Am i doing wrong? what does 131 mean?
Is there any difference between: distance = point1.subtract(point2).length; and distance = Point.distance(point1, point2);
View 3 RepliesI cannot arrive at dynamically showing the text in the dynamic text field when I move one any one of the MC on stage.
View 6 RepliesI am working on a project where I have 5 equal sized panels inside of a MC that I am using the following code on the loading of MC:
onClipEvent (load) {
targetx = 650.0;
delay = 8;
}
[Code]...
What I would like to do is ALSO move the panels with left and right arrows that act independently of navigation buttons. So that if you were on panel 2 you could advance to panel 3 or back to 1. Can I assign AS to the arrows to move the MC a specified distance left or right?
I'm building a touchscreen project that consists of flash and max/msp using Olaf Matthes flashserver as bi-directional control.
how I create a function in flash that will provide me with the distance of a concentric circle, so that as it grows I can use trace() to give me a constant stream of it's x & y coordinates?
I've also implemented a collision detection between two or more circles for the purpose of an overlap function. Trouble being that it's not quite working properly. I want the overlap function for the purpose of morphing sounds between the intersecting parts of the circles.
Here's the code I'm using:
[Code]....
Is there a way to calculate the distance between the origin of a movieClip at, say, (x:500, y:0, z:0) and one at, (x:500, y:0, z:50)?? And lets say the vanishing point is (0,0) and the perspective angle is 50.
I know that the eq for finding the distance between two points in 3D space is:
d = ((x1-x2)^2 +(y1-y2)^2+(z1-z2)^2)^(1/2)
the problem is I dont know x2 (the x value of MC2 (the one set at z = 50)).
[URL]
At first it seemed simple to find out the distance between two movieclips' x values, I could have just done:
Code:
mc1.x - mc2.x
However, What I'm trying to achieve is a movieclip of a person climbing an un-even surfaced wall, and to do this I first want to make sure the x value of the person is always equal to the edge of the wall.
How would I calculate the exact position of wall's edge where the person is touching it? I've attached an image to show what I mean.
I have a vertical list of movieclips added to the stage all spaced out evenly from top to bottom based of the last movieclips position. I also have defined a center Y point which I would like to find out the percentage of each clip away from that center point. The reason for this number is to scale everything from the center point which is scale 1 then they next item from the center would scale to a percentage from the center point. each clips scaling percentage would be based off of how far they are from the center point in each direction. Keeping in mind the center point is always scale to 1. I also want to make sure my scale never goes below 0.3 so the range has to be between 0.3 and 1 my centerY is also not half the height of the content but a number I decide. AS it the content might be 1000 in height but the center point could be set to 300.
[Code]...
I've scanned through the forums, but can't seem to find an answer to my question. I'm trying to move (tween) a movie clip 800 pixels along the x axis (horizontally) when a every time button is clicked. I don't want to move the movie clip to the 800 "x" pixel mark. Yet, I can't seem to move the clip an additional 800 pixels whenever the button is pressed again - it keeps starting from the original spot. I am new to ActionScript...
My code is below:
btnBottom1.addEventListener
(MouseEvent.MOUSE_DOWN, playHandler);
function playHandler(evt:MouseEvent):void {
import fl.transitions.Tween
import fl.transitions.easing.*;
var twTeen:Tween = new Tween(mcbottomFlap1, 'x', Elastic.easeOut, mcbottomFlap1.x, +800, 3, true);
}
I'm trying to get the distance between two objects. Problem is that both objects are -45º rotated but one of them moves up and down with stage resize. So the distance gets a random degree. I've attached an image so that it could be simpler to understand my problem.
View 3 RepliesI'm trying to calculate the distance between two images (A and F - there are other images between A and F) but I can't seem to figure out how to do it the right way. The image A.x is "(stage/2) - (A.width/2)" and image F.x is "E.x - imgSpace" which is a negative value (all the images x is of negative value to image A.x). In my oppinion the calculation is F.x - A.x and although it might be right I still ned the value to be non-negative.
View 3 RepliesI am trying to do something like this[code]...
Then how do I make it so all the children added are equal distance apart? I know I can set the X coordinates for each one,but I want it so that the objects can be added in any sequence and then be set to equal distance apart.
Not sure this exist, but worth asking you all: is there a built in method to compute the distance between the current mouse position and a given component? If not, is there a simple way to build a function like this that works for components with generic shapes?
View 2 RepliesI'm creating a drag based control in Flex / Flash, similar to a film strip, where an individual can swipe horizontally to scroll through the items. To make the control feel a bit more natural I've added some inertia to slow the scrolling once a swipe has taken place. When first loaded up there will be five items in view with 'x' numbers of items to scroll through with the 3rd item centred and selected.
My problem though is that I want, when animating, a swipe gesture to determine whether an item will end up the middle (3rd position) and adjust its movement calculation accordingly so it docks with the 3rd / centre position. Imagine you perform a long swipe, it flys pasts 'x' amount of items, but as it slows to a stop it elegantly stops with an item centred / in the 3rd position. To do this I believe I need to determine the distance to travel just from the speed value (as time is irrelevent to the user experience, i.e. a longer / stronger swipe would justify a longer animation skimming through the items).
At the moment I'm invoking the animation routine (with inertia) in the ENTER_FRAME event when the user generates a MOUSE_UP event. When they do this, I obtain the speed of drag (by monitoring this beforehand) and then decrement this speed value on each call of the ENTER_FRAME event until it reaches an appropriate value to stop the animation.
Unfortunately all the speed calculations I've seen deal with Speed and Time to determine distance, I just need Speed. Admittedly, my knowledge isn't strong in this area so I might be missing the obvious.