[OpenLayers-Dev] Transforming JS to work as Actionscript 3.0 in
Flash
Lars-Erik Siren
swedishskiracer at mac.com
Thu Nov 6 11:30:36 EST 2008
Has anyone tried this?
Flash Actionscript 3.0 for Google Maps API (THIS WORKS)
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.LatLng;
import com.google.maps.MapType;
var map:Map = new Map();
map.key = "apikeygoeshere";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
this.addChild(map);
function onMapReady(event:Event):void {
map.setCenter(new LatLng(42.373611,-71.110556), 14, MapType.HYBRID_MAP_TYPE);
Openlayers as Actionscript 3.0 (NOT SURE THE MAP TYPE)
What's wrong with this?
import com.metacarta.labs.MAP;
import com.metacarta.labs.MapEvent;
import com.metacarta.labs.LatLng;
import com.metacarta.labs.MapType;
var map:Map = new Map();
map = new OpenLayers.Map('map');
var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0",
{layers: 'basic'} );
var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
"http://t1.hypercube.telascience.org/cgi-bin/landsat7",
{layers: "landsat7"});
this.addChild(map);
function onMapReady(event:Event):void {
map.addLayers([ol_wms, jpl_wms]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
// map.setCenter(new OpenLayers.LonLat(0, 0), 0);
map.zoomToMaxExtent()
MapType.WMS_MAP_TYPE);
}
More information about the Dev
mailing list