Hey, I've found a solution!

private function createGrid():void {
        var polygon:Polygon;
        var multiplier:Number = 10;
        var evenWindowDivision:Number = windowWidth/multiplier;
        var pixel:Point;
        var getLatLng:LatLng;
        var getLatLngWH:LatLng;
        var tileWidth:Number;
        var tileHeight:Number;
        var nwLat:Number;
        var nwLng:Number;
        var seLat:Number;
        var seLng:Number;
        var tileArray:Array = [];               //This array holds the points 
(on-screen
pixel coordinates) that are the top-left corner of each tile
        var polyTileArray:Array = [];   //This array holds the actual polygons
that are displayed on screen

        for(var row:Number = 0; row < evenWindowDivision; row++){
                for(var col:Number = 0; col < evenWindowDivision; col++){
                        pixel = new Point(col*multiplier, row*multiplier);
                        //getLatLng = this.map.fromViewportToLatLng(pixel);
                        //tileArray.push(getLatLng);
                        tileArray.push(pixel);
                }
        }

        for(var i:Number = 0; i < tileArray.length; i++){
                //trace("Tile #"+i+" coordinates: "+tileArray[i]);
                tileWidth = tileArray[i].x + multiplier;
                tileHeight = tileArray[i].y + multiplier;
                getLatLng = this.map.fromViewportToLatLng(tileArray[i]);
                getLatLngWH = this.map.fromViewportToLatLng(new Point(tileWidth,
tileHeight));
                nwLat = getLatLng.lat();
                nwLng = getLatLng.lng();
                seLat = getLatLngWH.lat();
                seLng = getLatLngWH.lng();

                polygon = new Polygon([
                        new LatLng(nwLat, nwLng),
                        new LatLng(nwLat, seLng),
                        new LatLng(seLat, seLng),
                        new LatLng(seLat, nwLng),
                        new LatLng(nwLat, nwLng)
                ],
                new PolygonOptions({
                        strokeStyle: new StrokeStyle({
                                color: 0x000000,
                                thickness: 1,
                                alpha: 1.0}),
                        fillStyle: new FillStyle({
                                color: 0xFFFFFF,
                                alpha: 0.0})
                }));

                polyTileArray.push(polygon);
                this.map.addOverlay(polygon);
        }
        polyTileArray[36].setOptions(new PolygonOptions({fillStyle: new
FillStyle({color: 0xFF6600, alpha: 0.5})}));
}

This lets me draw a grid of polygons over the map (500x500 in size).
If you change the "multiplier" variable, it will scale the polygons
appropriately.
However, since it is an array of polygons, this option is slow to load
and causes map dragging to be slow as well.
What I'd like to try instead is drawing a grid directly on the
viewport. But I'm not able to figure out how to even access the
viewport directly, if it's even possible. Has anyone tried this?

-- 
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