[Laszlo-dev] I got Google map component working in swf9
Henry Minsky
hminsky at laszlosystems.com
Tue Nov 18 10:34:23 PST 2008
That's really cool!
On Tue, Nov 18, 2008 at 12:37 PM, Antun Karlovac
<antun at laszlosystems.com> wrote:
> Hi Henry,
>
> Thanks for your help on this. I extended the example to include geocoding an
> address using OL datasets, and passing information to/from the map
> component. Instructions are here:
>
> http://www.antunkarlovac.com/blog/2008/11/17/google-maps-in-openlaszlo/
>
> Did I link to the right web site for you (beartronics.com)?
>
> Thanks,
>
> Antun
>
> Henry Minsky wrote:
>>
>> 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
More information about the Laszlo-dev
mailing list