Google Maps Integration
From Frontal Wiki
Here is an example of how to import a SWF that has the Google Maps Action Script 3 API compiled into it. (Sometimes we want the extra performance boost of using compiled code or we want to use an AS3 library that isn't easily ported to the Frontal scripting language or that we don't have the source code to.)
<include rel="assets" type="application/x-shockwave-flash" src="http://www.frontalcode.com/assets/swfs/Gmaps.swf" blocking="true"> <import>com.google.maps.Map</import> <import>com.google.maps.MapEvent</import> <import>com.google.maps.LatLng</import> <import>com.google.maps.MapType</import> <import>com.google.maps.MapOptions</import> <import>com.google.maps.MapMouseEvent</import> <import>com.google.maps.controls.ZoomControl</import> <import>com.google.maps.controls.PositionControl</import> <import>com.google.maps.controls.MapTypeControl</import> <import>com.google.maps.overlays.Marker</import> <import>com.google.maps.overlays.MarkerOptions</import> </include> <style><![CDATA[ .map { @onFirstDocumentPreRender { dynamic.basikLatLng = new LatLng(40.745664,-73.988907); /* Functions must be declared before their references in the code block */ dynamic.onMapReady = function (event) { // Add the usual array of controls dynamic.map.addControl(new ZoomControl()); dynamic.map.addControl(new PositionControl()); dynamic.map.addControl(new MapTypeControl()); // Add a marker var marker = new Marker(dynamic.map.getCenter(), new MarkerOptions({draggable: true})); marker.addEventListener(MapMouseEvent.DRAG_START, function(event) { dynamic.map.closeInfoWindow(); }); marker.addEventListener(MapMouseEvent.DRAG_END, function(event) { var distance = marker.distanceFrom(dynamic.basikLatLng); var options = new InfoWindowOptions(); options [ "content" ] = distance; dynamic.marker.openInfoWindow(new InfoWindowOptions({content:distance})); }); dynamic.map.addOverlay(marker); } // Set up map options for preinitialization to avoid loading the default view // in addition to the initial target dynamic.onPreinitialize = function (event) { // setInitOptions is the only call available at preinit time var myMapOptions = new MapOptions(); myMapOptions.zoom = 14; myMapOptions.center = new LatLng (40.736072,-73.992062); myMapOptions.mapType = MapType.NORMAL_MAP_TYPE; dynamic.map.setInitOptions(myMapOptions); } // Instantiate our map dynamic.map = new Map(); // Set the API key dynamic.map.key = "ABQIAAAAuV9Of761mXG7kAyhznSkjRSoiJB0_nJaPQ_HIU9YiGRu5S0O-RQ5ToogA0PPOjx_E1wrfOzbWzcmGA"; // Add our listeners dynamic.map.addEventListener(MapEvent.MAP_PREINITIALIZE, dynamic.onPreinitialize); dynamic.map.addEventListener(MapEvent.MAP_READY, dynamic.onMapReady); // Insert the map into the div movie.addChildAt ( dynamic.map, 0 ); } @onCustomRender { if ( dynamic.map != null ) { dynamic.map.setSize ( new flash.geom.Point ( width, height ) ); } } } ]]></style> <div style="processes-own-content: true; width: 100%; height: 100%;" class="map"> </div>