Try something like this:

var markerPosition:Point =
map.fromLatLngToViewport(marker1.getLatLng());
var difference:Point = markerPosition.subtract(new
Point(circle.x,circle.y));
trace( difference.length );


That should give you the distance between the circle and marker in
viewport pixels.

Michael


On Feb 7, 3:44 pm, Daniel <[email protected]> wrote:
> Ill have to look at that later. Have you tried using circle.getLatLng().lat
> or circle.getLatLng().lng
>
> That is what I was asking earlier about getting the lat lng of your object.
> Then you could use the the difference of the circle lat and/or lng and the
> markers lat lng to get a percentage and base the volume off of that. If
> wouldn't matter if the path was not straight you could just use a function
> that uses both lat and lng to create a virtual diagonal path.
>
>
>
>
>
>
>
> On Sun, Feb 6, 2011 at 7:45 PM, Thomas <[email protected]> wrote:
> > I'm afraid I don't. I'm moving both the map and the object but the values
> > returned are staying the same.
>
> > I stripped out the vast majority of the code so here is my entire code at
> > the moment:
>
> > stop();
>
> > import com.google.maps.LatLng;
> > import com.google.maps.Map;
> > import com.google.maps.MapEvent;
> > import com.google.maps.MapType;
> > import com.google.maps.controls.MapTypeControl;
> > import com.google.maps.controls.ZoomControl;
> > import com.google.maps.controls.PositionControl;
> > import com.google.maps.overlays.Marker;
> > import com.google.maps.overlays.MarkerOptions;
> > import com.google.maps.InfoWindowOptions;
> > import com.google.maps.MapMouseEvent;
> > import fl.controls.Slider;
> > import fl.events.SliderEvent;
>
> > var aura_slider:Slider = new Slider();
> > aura_slider.liveDragging = false;
> > aura_slider.setSize(120,20);
> > aura_slider.maximum = 100;
> > aura_slider.minimum = 10;
> > aura_slider.snapInterval = 1;
> > aura_slider.value= 55;
> > aura_slider.x = 335;
> > aura_slider.y = 615;
> > addChild(aura_slider);
>
> > var sound1:Sound = new Sound();
> > sound1.load(new URLRequest("Munster.mp3"));
> > var sc1:SoundChannel = new SoundChannel();
>
> > var circle:Sprite = new Sprite();
> > var map:Map = new Map();
> > map.key = "api_key";
> > map.setSize(new Point(stage.stageWidth/2, stage.stageHeight/2));
> > map.x = stage.stageWidth*.5 - map.width*.5;
> > map.y = stage.stageHeight*.5 - map.height*.5;
> > map.addEventListener(MapEvent.MAP_READY, onMapReady);
> > this.addChild(map);
>
> > var ismapshowing:Boolean = false;
> > function onMapReady(event:Event):void {
> >   map.setCenter(new LatLng(52.664900,-8.624), 13,
> > MapType.SATELLITE_MAP_TYPE);
> >   map.addControl(new ZoomControl());
> >   map.addControl(new PositionControl());
> >   map.addControl(new MapTypeControl());
>
> >  var marker1:Marker = new Marker(
> >             new LatLng(52.67427395924242, -8.642496513366702),
> >             new MarkerOptions({
> >                 radius: 8,
> >                 hasShadow: true
> >             })
> >         );
>
> >  map.addOverlay(marker1);
>
> > addEventListener(Event.ENTER_FRAME, changeSize);
> > function changeSize():void
> > {
> > circle.graphics.clear();
> > var circleradius:Number = aura_slider.value;
> > circle.graphics.lineStyle(3, 0x000000, 1);
> > var fillType:String = GradientType.RADIAL;
> > var colors:Array = [0xFF0000, 0x0000FF];
> > var alphas:Array = [0, 150];
> > var ratios:Array = [100, 255];
> > var matr:Matrix = new Matrix();
> > matr.createGradientBox(200, 100, 0, -50, 100);
> > var spreadMethod:String = SpreadMethod.REPEAT;
> > circle.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr,
> > spreadMethod);
> > circle.graphics.drawCircle(stage.stageWidth*.5 - map.width*.5,
> > stage.stageHeight*.5 - map.height*.5, circleradius);
> > addChild(circle)
> > var rectangle:Rectangle = new Rectangle((stage.stageWidth*.5 -
> > map.width)+circleradius, (stage.stageHeight*.5 - map.height)+circleradius,
> > map.width-(circleradius*2), map.height - (circleradius*2));
> > circle.addEventListener(MouseEvent.MOUSE_DOWN, presscircle);
> > function presscircle(e:Event){
> > circle.startDrag(false, rectangle);
> > }
> > stage.addEventListener(MouseEvent.MOUSE_UP, releasecircle);
> > function releasecircle(e:Event){
> >     circle.stopDrag();
>
> > }
> > }
>
> > var ptMC1:Point = new Point(circle.x, circle.y);
> > var currentProjection = map.getProjection();
> > var x3 = currentProjection.fromPixelToLatLng(ptMC1, 13);
>
> > var markerContent:LatLng = marker1.getLatLng();
> > var currentProjection1 = map.getProjection();
> > var xy = currentProjection1.fromLatLngToPixel(markerContent, 13);
>
> > addEventListener(Event.ENTER_FRAME, movingHits1);
> >     function movingHits1(e:Event):void{
>
> >     if(marker1.foreground.hitTestObject(circle)) {
> >         sc1 = sound1.play();
> >             // convert to map coordinates for a mercator projection
>
> > trace(x3);
> > trace(xy);
> >         sc1.addEventListener(Event.SOUND_COMPLETE, loop1);
> >         function loop1():void{
> >             sc1 = sound1.play();
> >             sc1.addEventListener(Event.SOUND_COMPLETE, loop1);
> >         }
> >     removeEventListener(Event.ENTER_FRAME, movingHits1);
> >     addEventListener(Event.ENTER_FRAME, moveOff1)
> >         function moveOff1(e:Event):void{
> >         if(marker1.foreground.hitTestObject(circle) == false){
> >             sc1.stop();
> >     addEventListener(Event.ENTER_FRAME, movingHits1);
> >                                                     }
> >                                         }
> >                             }
> >                 }
> > }
>
> > Most of that is fairly negligible but it's the minimum required for the
> > file to run correctly.
> > The LngLot value for the sprite being returned is 85.0511287798066, -180
> > and the x,y value returned for the marker is x=998229.8087555555,
> > y=686292.2541199704
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps API For Flash" group.
> > To post to this group, send email to
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group at
> >http://groups.google.com/group/google-maps-api-for-flash?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api-for-flash?hl=en.

Reply via email to