Jason,
Think what your after is something along thes lines
var latlong:String = '-35.191374, 174.035009';
var latLongParts:Array = latlong.split(',');
var point:LatLng = new LatLng(Number(latLongParts[0]),Number
(latLongParts[1]));
var marker:Marker = new Marker(point);
On Sep 4, 8:04 am, Jason <[email protected]> wrote:
> /*
> Hi, im going to pass a variable from URL or a parameter to the flash
> movie of a latitute & longitude coordinate, I can do that but that
> step isnt included in this code.
> But i'm struggling with the AS3. It should be easy but i cant replace
> the LatLng coordinates with a variable.
> Ive tried a number of ways but just struggling. Ive given an example
> in the commented code below that doesnt work but shows what im trying
> to achieve.
> thanks :D */
>
> import flash.events.Event;
> import com.google.maps.LatLng;
> import com.google.maps.Map;
> import com.google.maps.MapEvent;
> import com.google.maps.MapMouseEvent;
> import com.google.maps.MapType;
> import com.google.maps.controls.MapTypeControl;
> import com.google.maps.controls.ZoomControl;
> import com.google.maps.overlays.Marker;
> import com.google.maps.overlays.MarkerOptions;
> import com.google.maps.styles.FillStyle;
> import com.google.maps.styles.StrokeStyle;
>
> var map:Map = new Map();
> map.key =
> "ABQIAAAAtBM6Nx9YRYNohePLc8qC7xTovViODZS-2gPQGT5YvR89FM8GRRRn5usK_wnzRXi36po4CMrwH_eN-
> w";
> map.setSize(new Point(stage.stageWidth, stage.stageHeight));
>
> map.addEventListener(MapEvent.MAP_READY, onMapReady);
> this.addChild(map);
>
> function onMapReady(event:Event):void {
> map.setCenter(new LatLng(-35.189416, 173.99898), 11,
> MapType.NORMAL_MAP_TYPE);
>
> map.addControl(new ZoomControl());
> map.addControl(new MapTypeControl());
>
> // I want the following 2 lines of code to replace the line after
> // var latlong:String = '-35.191374, 174.035009';
>
> // var marker:Marker = new Marker(new LatLng(latlong),
>
> var marker:Marker = new Marker(new LatLng(-35.191374, 174.035009),
>
> new MarkerOptions({
> strokeStyle: new StrokeStyle({color: 0x000000}),
> fillStyle: new FillStyle({color: 0xe31e24,
> alpha: 0.8}),
> radius: 12,
> hasShadow: true
> }));
> map.addOverlay(marker);
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---