[Laszlo-dev] I got Google map component working in swf9

Antun Karlovac antun at laszlosystems.com
Sat Nov 8 13:41:57 PST 2008


Hey Henry,

That's awesome; I've done a quick test and it works fine in 4.2b3. I'll 
write up some instructions and post them soon.

Thanks for the help!

-Antun

Henry Minsky wrote:
> Here's an example of the Google map component running in a LZX <window>
> 
> There is a Google discussion group regarding a non-flex Flash map component at
> 
> http://groups.google.com/group/google-maps-api-for-flash
> 
> They have a library which seems to have remove the dependencies on the
> Flex mx.* framework.
> 
> You just need to  download the library map_flash_1_6.swc from
> http://groups.google.com/group/google-maps-api-for-flash/files
> and copy that to WEB-INF/flexlib
> 
> then the following code compiles and runs in swf9 runtime and displays
> the map component.
> 
> 
> <canvas debug="true">
> 
>   <script when="immediate"><![CDATA[
>          class FlashMapOL {
>             #passthrough (toplevel: true) {
>             import com.google.maps.*;
>             import flash.geom.*;
>             }#
> 
>             var map:Map;
> 
>             function createMap() {
>                 map = new Map();
>                 map.addEventListener(MapEvent.MAP_READY, onMapReady);
>                 // Henry's key
>                 map.key =
> "ABQIAAAAT-bIcrU96-d2UT9ao4fuQhQeYAb4p95ZEYTsQwGDQ7cOBxduDBQsJj99qzzLWoeHwQer1vjPN0wTNg";
>                 map.setSize(new Point(LFCApplication.stage.stageWidth,
> LFCApplication.stage.stageHeight));
>                 return map;
>             }
> 
>              function onMapReady(event:MapEvent):void {
>                 this.map.setCenter(new LatLng(40.736072,-73.992062),
> 14, MapType.NORMAL_MAP_TYPE);
>             }
> 
>         }
> 
>         var mapfactory = new FlashMapOL();
>         lz.map = mapfactory.createMap();
> 
>     ]]>
>     </script>
> 
>   <window id="mapwin" width="640" height="480">
>     <passthrough>
>       import flash.display.*;
>     </passthrough>
>     <handler name="oninit">
>       var sprite:Sprite = this.content.sprite
>       sprite.addChildAt(lz.map, sprite.numChildren);
>     </handler>
>   </window>
> 
> 
> 
> </canvas>
> 
> 
> 
> 
> 
> 
> 


More information about the Laszlo-dev mailing list