[Laszlo-dev] I got Google map component working in swf9
Henry Minsky
hminsky at laszlosystems.com
Sun Nov 9 12:50:22 PST 2008
I attached a sample app which calls the geocoding API to look up an
address, and displays a marker for
it, and then drops a marker at the map center each time the map is moved.
On Sat, Nov 8, 2008 at 4:41 PM, Antun Karlovac <antun at laszlosystems.com> wrote:
> 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>
>>
>>
>>
>>
>>
>>
>>
>
--
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: draglon.lzx
Type: application/octet-stream
Size: 4080 bytes
Desc: not available
Url : http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20081109/3e79a584/draglon.obj
More information about the Laszlo-dev
mailing list