Hi Jesse,
Try this:
=== GoogleMap.as ===
package lib
{
import flash.events.Event;
import flash.geom.Point;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.LatLng;
public class GoogleMap extends Map
{
public function GoogleMap(apiKey =
"*************************************************************")
{
super();
key = apiKey;
addEventListener(MapEvent.MAP_READY, onMapReady);
}
private function onMapReady(event:MapEvent):void
{
setSize(new Point(stage.stageWidth, stage.stageHeight));
setCenter(new LatLng(40.736072,-73.992062), 14,
MapType.NORMAL_MAP_TYPE);
}
}
}
If "setSize" isn't called, you'll just get the controls, but no map.
(Second time I've answered this one... Pam, you watching? Worthy of a
bug/feature report?)
But, keep in mind that you can't use the map until it's loaded. So,
I'd recommend instead of extending "Map," extend "MovieClip" and add
the map inside there, then treat "GoogleMap" as any other clip.
<Ed>
On Sep 17, 1:36 pm, Jesse Foltz <[EMAIL PROTECTED]> wrote:
> I have been trying to use this api in Flash NOT Flex. And I'm running
> into a problem just being able to display things correctly. I wanted
> to create a GoogleMap class so I can insert the map dynamically into
> my flash. But I can't seem to set the size of the map. Can any one
> take a guess:
>
> Grapher.as (the class I want to build my app in)
> package lib{
>
> import lib.GoogleMap;
> import flash.display.MovieClip;
>
> public class Grapher extends flash.display.MovieClip{
>
> function Grapher():void
> {
> var map:GoogleMap = new GoogleMap();
> addChild(map);
> }
> }
>
> }
>
> GoogeMap.as
> package lib{
>
> import flash.events.Event;
> import com.google.maps.Map;
> import com.google.maps.MapEvent;
> import com.google.maps.MapType;
> import com.google.maps.LatLng;
>
> public class GoogleMap extends Map {
>
> public function GoogleMap(apiKey =
> "*************************************************************") {
> super();
> key = apiKey;
> addEventListener(MapEvent.MAP_READY, onMapReady);
> }
>
> private function onMapReady(event:MapEvent):void {
> setCenter(new LatLng(40.736072,-73.992062), 14,
> MapType.NORMAL_MAP_TYPE);
> }
>
> }
> }
>
> The Flash's Document Class is set to Grapher.as. It loads the map
> with 0 height and 0 width at 0,0 if I drag the window out I can see
> the google copyright stuff. If I set the flash's document class to
> GoogleMap. The map loads fine and shows 100% 100%. Can I somehow set
> the size of a dynamic map?
>
> Thanks,
> Jesse
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---