Good morning Bill. If you are coding out of the timeline, Im assuming you are using FlashDevelop or something of that nature. IF you are on a PC I HIGHLY recommend FlashDevelop for writing your code. The code hinting is simply unmatched. (( http://www.flashdevelop.org/community/viewforum.php?f=11 << link to download ))
Here is a link to a zip file - this should get you started. Its not exactly the code you have above, this one is a few steps further in the Flash API tutorial for GoogleMaps. But you can definately see where its gone. >From your code above a few things I notice. import com.google.maps.MapOptions; You are missing this import. (that is how you would setCenter) Also in a class file (pure .as / as in not on the timeline) you can only have one public class And finally its always preferable to declare your variables as public or private or static See the attached zip file and feel free to respond if you have further questions. I have set this up as a FlashDevelop project - so if you go that route, just double click the .project file to get started. Everything is setup for you. http://www.myvideosnapshots.com/examples/googlemaps/google_initMap.zip On Mar 18, 2:52 am, c1natra <[email protected]> wrote: > Hello - > > I'm trying to port the Hello World code Google provides in their > tutorial to my .as file instead of adding it to a frame, and can't get > it to work properly. Here is my code: > > package { > > import flash.display.*; > import flash.events.Event; > import flash.geom.Point; > import com.google.maps.LatLng; > import com.google.maps.Map; > import com.google.maps.MapEvent; > import com.google.maps.MapType; > > public class Final02 extends Map { > > var map:Map = new Map(); > > public function Final02() { > > map.key = "MyKeyHere"; > map.addEventListener(MapEvent.MAP_READY, onMapReady); > } > > public function onMapReady(event:Event):void { > map.setSize(new Point(stage.stageWidth, > stage.stageHeight)); > map.setCenter(new LatLng(40.736072,-73.992062), 14, > MapType.NORMAL_MAP_TYPE); > > } > } > > } > > This doesn't error, but I only get the generic map the world. The > setCenter method isn't working, among other bugs I'm sure. Can anyone > point me in the right direction? > > Thanks in advance...! > > Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
