Repository: flex-asjs
Updated Branches:
  refs/heads/core_js_to_as c3c2403fe -> 325df7b0f


Competed back-port of GoogleMaps.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/325df7b0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/325df7b0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/325df7b0

Branch: refs/heads/core_js_to_as
Commit: 325df7b0f40c015374e4bd29824d9db751d9d2e7
Parents: c3c2403
Author: Peter Ent <[email protected]>
Authored: Wed Dec 16 10:30:29 2015 -0500
Committer: Peter Ent <[email protected]>
Committed: Wed Dec 16 10:30:29 2015 -0500

----------------------------------------------------------------------
 .../flexjs/MapSearch/src/MyInitialView.mxml     |   4 +-
 frameworks/projects/GoogleMaps/as/defaults.css  |   2 +-
 .../org/apache/flex/maps/google/GoogleMap.as    |  10 +-
 .../flex/maps/google/beads/GoogleMapView.as     | 235 +++++----
 .../apache/flex/maps/google/beads/MapView.as    | 515 -------------------
 .../flex/maps/google/beads/MapView_original.as  | 515 +++++++++++++++++++
 .../apache/flex/maps/google/models/MapModel.as  |  60 +--
 .../projects/GoogleMaps/google-manifest.xml     |   2 +-
 8 files changed, 672 insertions(+), 671 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/examples/flexjs/MapSearch/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MapSearch/src/MyInitialView.mxml 
b/examples/flexjs/MapSearch/src/MyInitialView.mxml
index bf302fa..0269c58 100644
--- a/examples/flexjs/MapSearch/src/MyInitialView.mxml
+++ b/examples/flexjs/MapSearch/src/MyInitialView.mxml
@@ -112,7 +112,7 @@ limitations under the License.
                         */
                        private function 
onMarkerClicked(event:org.apache.flex.events.Event):void
                        {
-                               var marker:Marker = map.selectedMarker;
+                               var marker:Marker = map.selectedMarker as 
Marker;
                                map.setZoom(12);
                                map.setCenter(marker.getPosition());
                        }
@@ -182,7 +182,7 @@ limitations under the License.
                                                                
dataProvider="{MyModel(applicationModel).cities}" />
                </js:Container>
                
-               <google:GoogleMap id="map" width="450" height="300" 
className="MainMap"
+               <google:Map id="map" width="450" height="300" 
className="MainMap"
                                   
token="AIzaSyDkQgg2iojLCYeuW6hK7DkuAHD-SwJJhdE" 
                                   ready="onMapReady()"/>
                

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/GoogleMaps/as/defaults.css 
b/frameworks/projects/GoogleMaps/as/defaults.css
index 260517a..214e84f 100644
--- a/frameworks/projects/GoogleMaps/as/defaults.css
+++ b/frameworks/projects/GoogleMaps/as/defaults.css
@@ -19,7 +19,7 @@
 
 @namespace g "library://ns.apache.org/flexjs/google";
 
-g|GoogleMap
+g|Map
 {
     IBeadView: 
ClassReference("org.apache.flex.maps.google.beads.GoogleMapView");
        IBeadModel: 
ClassReference("org.apache.flex.maps.google.models.MapModel");

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/GoogleMap.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/GoogleMap.as
 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/GoogleMap.as
index 64ae26b..e662e41 100644
--- 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/GoogleMap.as
+++ 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/GoogleMap.as
@@ -26,11 +26,8 @@ package org.apache.flex.maps.google
        import org.apache.flex.maps.google.beads.GoogleMapView;
        import org.apache.flex.maps.google.models.MapModel;
 
-       COMPILE::JS {
-               import google.maps.LatLng;
-               import google.maps.Marker;
-               import org.apache.flex.core.WrappedHTMLElement;
-       }
+       import google.maps.LatLng;
+       import google.maps.Marker;
 
        [Event(name="ready", type="org.apache.flex.events.Event")]
        [Event(name="centered", type="org.apache.flex.events.Event")]
@@ -77,7 +74,6 @@ package org.apache.flex.maps.google
                        MapModel(model).token = value;
                }
 
-               COMPILE::JS
                public function get selectedMarker():Marker
                {
                        return MapModel(model).selectedMarker;
@@ -103,7 +99,6 @@ package org.apache.flex.maps.google
                        GoogleMapView(view).centerOnAddress(address);
                }
 
-               COMPILE::JS
                public function setCenter(location:LatLng):void
                {
                        GoogleMapView(view).setCenter(location);
@@ -119,7 +114,6 @@ package org.apache.flex.maps.google
                        GoogleMapView(view).markAddress(address);
                }
 
-               COMPILE::JS
                public function createMarker(location:LatLng):Marker
                {
                        return GoogleMapView(view).createMarker(location);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/GoogleMapView.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/GoogleMapView.as
 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/GoogleMapView.as
index 61c31e3..f8fb790 100644
--- 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/GoogleMapView.as
+++ 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/GoogleMapView.as
@@ -23,7 +23,7 @@ package org.apache.flex.maps.google.beads
                import flash.html.HTMLLoader;
                import flash.net.URLRequest;
        }
-       
+
     import org.apache.flex.core.BeadViewBase;
        import org.apache.flex.core.IBeadModel;
        import org.apache.flex.core.IBeadView;
@@ -33,24 +33,25 @@ package org.apache.flex.maps.google.beads
        import org.apache.flex.events.IEventDispatcher;
        import org.apache.flex.maps.google.GoogleMap;
        import org.apache.flex.maps.google.models.MapModel;
-       
+
        COMPILE::JS {
                import goog.bind;
-               import google.maps.event;
-               import google.maps.Geocoder;
-               import google.maps.GeocoderResult;
-               import google.maps.GeocoderStatus;
-               import google.maps.LatLng;
-               import google.maps.Map;
-               import google.maps.Marker;
-               import google.maps.places.PlaceResult;
-               import google.maps.places.PlacesService;
-               import google.maps.places.PlacesServiceStatus;
        }
-       
+
+       import google.maps.event;
+       import google.maps.Geocoder;
+       import google.maps.GeocoderResult;
+       import google.maps.GeocoderStatus;
+       import google.maps.LatLng;
+       import google.maps.Map;
+       import google.maps.Marker;
+       import google.maps.places.PlaceResult;
+       import google.maps.places.PlacesService;
+       import google.maps.places.PlacesServiceStatus;
+
        /**
         *  The MapView bead class displays a Google Map using HTMLLoader.
-        *  
+        *
         *  @langversion 3.0
         *  @playerversion Flash 10.2
         *  @playerversion AIR 2.6
@@ -63,42 +64,39 @@ package org.apache.flex.maps.google.beads
                {
                        super();
                }
-               
-               private var map:Map;
+
+               private var realMap:Map;
                private var geocoder:Geocoder;
                private var initialized:Boolean = false;
                private var markers:Array;
                private var searchResults:Array;
                private var service:PlacesService;
-               
+
                private var _strand:IStrand;
-                               
+
                override public function set strand(value:IStrand):void
                {
                        super.strand = value;
                        _strand = value;
-                       
+
                        var token:String = (_strand as GoogleMap).token;
                        var src:String = 
'https://maps.googleapis.com/maps/api/js?v=3.exp';
                        if (token)
                                src += '&key=' + token;
-                       src += 
'&libraries=places&sensor=false&callback=mapInit';
-                       
+                       src += 
'&libraries=geometry,places&sensor=false&callback=mapInit';
+
                        var script:HTMLScriptElement = 
document.createElement('script') as HTMLScriptElement;
                        script.type = 'text/javascript';
                        script.src = src;
-                       
+
                        window['mapView'] = this;
                        window['mapInit'] = function():void {
                                (this['mapView'] as 
GoogleMapView).finishInitialization();
                        }
-                       
+
                        document.head.appendChild(script);
-                       
-                       var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.addEventListener("zoomChanged", 
handleModelChange);
                }
-               
+
                public function mapit( centerLat:Number, centerLng:Number, 
zoom:Number ):void
                {
                        if (!initialized) {
@@ -108,42 +106,44 @@ package org.apache.flex.maps.google.beads
                                var mapOptions:Object = new Object();
                                mapOptions['center'] = model.currentCenter;
                                mapOptions['zoom'] = zoom;
-                               
-                               map = new Map((_strand as UIBase).element, 
mapOptions);
+
+                               realMap = new Map((_strand as UIBase).element, 
mapOptions);
                                geocoder = null;
-                               
-                               google.maps.event.addListener(map, 
'center_changed', goog.bind(centerChangeHandler, this));
-                               google.maps.event.addListener(map, 
'bounds_changed', goog.bind(boundsChangeHandler, this));
-                               google.maps.event.addListener(map, 
'zoom_changed',   goog.bind(zoomChangeHandler,   this));
+
+                           model.addEventListener("zoomChanged", 
handleModelChange);
+
+                               google.maps.event.addListener(realMap, 
'center_changed', goog.bind(centerChangeHandler, this));
+                               google.maps.event.addListener(realMap, 
'bounds_changed', goog.bind(boundsChangeHandler, this));
+                               google.maps.event.addListener(realMap, 
'zoom_changed',   goog.bind(zoomChangeHandler,   this));
                        }
                }
-               
+
                private function finishInitialization():void
                {
                        mapit(37.333, -121.900, 12);
                        initialized = true;
                        dispatchEvent(new Event('ready'));
                }
-               
+
                public function centerOnAddress(value:String):void
                {
                        if (geocoder == null) geocoder = new Geocoder();
                        geocoder.geocode({address:value}, positionHandler);
                }
-               
+
                public function setCenter(location:LatLng):void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
                        model.currentCenter = new LatLng(location.lat(), 
location.lng());
-                       map.setCenter(model.currentCenter as LatLng);
+                       realMap.setCenter(model.currentCenter as LatLng);
                }
-               
+
                public function markCurrentLocation():void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
                        createMarker(model.currentCenter as LatLng);
                }
-               
+
                public function markAddress(address:String):void
                {
                        if (initialized) {
@@ -151,23 +151,23 @@ package org.apache.flex.maps.google.beads
                                geocoder.geocode({address:address}, 
geocodeHandler);
                        }
                }
-               
+
                public function createMarker(location:LatLng):Marker
                {
-                       var marker:Marker = new Marker({map:map, 
position:location});
+                       var marker:Marker = new Marker({map:realMap, 
position:location});
                        google.maps.event.addListener(marker, 'click', 
goog.bind(markerClicked, this));
                        return marker;
                }
-               
+
                public function nearbySearch(placeName:String):void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       
+
                        if (markers == null) markers = [];
-                       service = new PlacesService(map);
+                       service = new PlacesService(realMap);
                        service.nearbySearch({location:model.currentCenter, 
radius:5000, name:placeName}, searchResultsHandler);
                }
-               
+
                public function clearSearchResults():void
                {
                        if (markers) {
@@ -178,84 +178,85 @@ package org.apache.flex.maps.google.beads
                                markers = null;
                        }
                }
-               
+
                // Callbacks
-               
+
                public function centerChangeHandler() : void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.currentCenter = map.getCenter();
-                       
+                       model.currentCenter = realMap.getCenter();
+
                        var newEvent:Event = new Event('centered');
                        (_strand as IEventDispatcher).dispatchEvent(newEvent);
                }
-               
+
                public function boundsChangeHandler():void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.currentCenter = map.getCenter();
-                       
+                       model.currentCenter = realMap.getCenter();
+
                        var newEvent:Event = new Event('boundsChanged');
                        (_strand as IEventDispatcher).dispatchEvent(newEvent);
                }
-               
+
                public function zoomChangeHandler():void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.currentCenter = map.getCenter();
-                       
+                       model.currentCenter = realMap.getCenter();
+
                        var newEvent:Event = new Event('zoomChanged');
                        (_strand as IEventDispatcher).dispatchEvent(newEvent);
                }
-               
-               public function positionHandler(results, status):void
+
+               public function positionHandler(results:Array, 
status:String):void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
                        if (status == GeocoderStatus.OK) {
                                model.currentCenter = 
results[0].geometry.location;
-                               map.setCenter(model.currentCenter as LatLng);
-                               
+                               realMap.setCenter(model.currentCenter as 
LatLng);
+
                                // dispatch an event to indicate the map has 
been centered
                        }
                }
-               
-               public function geocodeHandler(results, status):void
+
+               public function geocodeHandler(results:Array, 
status:String):void
                {
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
                        if (status == GeocoderStatus.OK) {
                                model.currentCenter = 
results[0].geometry.location;
-                               map.setCenter(model.currentCenter as LatLng);
-                               
-                               var marker:Marker = new Marker({map:map, 
position:model.currentCenter});
+                               realMap.setCenter(model.currentCenter as 
LatLng);
+
+                               var marker:Marker = new Marker({map:realMap, 
position:model.currentCenter});
                        }
                }
-               
-               public function searchResultsHandler(results, status):void
+
+               public function searchResultsHandler(results:Array, 
status:String):void
                {
                        searchResults = [];
                        if (status == PlacesServiceStatus.OK) {
                                for(var i:int=0; i < results.length; i++) {
-                                       var place:PlaceResult = new 
PlaceResult();
+                                       /*var place:PlaceResult = new 
PlaceResult();
                                        place.geometry.location = new 
LatLng(results[i].geometry.location.lat(), results[i].geometry.location.lng());
                                        place.icon = results[i].icon;
                                        place.id = results[i].id;
                                        place.name = results[i].name;
                                        place.reference = results[i].reference;
-                                       place.vicinity = results[i].vicinity;
+                                       place.vicinity = results[i].vicinity;*/
+                                       var place:Object = results[i];
                                        searchResults.push(place);
-                                       
+
                                        var marker:Marker = 
createMarker(place.geometry.location);
                                        marker.setTitle(place.name);
-                                       
+
                                        markers.push(marker);
                                }
                                var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
                                model.searchResults = searchResults;
                        }
                }
-               
+
                // Event handlers
-               
+
                /**
                 * Handles changes to properties of the MapModel. When this 
value is
                 * changed, the map itself has its zoom changed. This will 
trigger an
@@ -265,26 +266,27 @@ package org.apache.flex.maps.google.beads
                {
                        if (event.type == "zoomChanged") {
                                var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
-                               map.setZoom(model.zoom);
+                               realMap.setZoom(model.zoom);
                        }
                }
-               
+
                public function markerClicked(marker:Marker, event:Object):void
                {
                        var newMarker:Marker = new Marker();
-                       newMarker.setPosition(new 
LatLng(marker.getPosition().lat(), marker.getPosition().lng()));
+                       var pos:LatLng = marker.getPosition();
+                       newMarker.setPosition(pos);
                        newMarker.setTitle(marker.getTitle());
-                       newMarker.setMap(map);
-                       
+                       newMarker.setMap(realMap);
+
                        var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
                        model.selectedMarker = newMarker;
-                       
+
                        var newEvent:Event = new Event('markerClicked');
                        dispatchEvent(newEvent);
                }
-               
+
        } // end ::JS
-       
+
        /**
         * The AS3 version of GoogleMapView is geared toward its use with 
HTMLLoader
         * for AIR.
@@ -304,12 +306,12 @@ package org.apache.flex.maps.google.beads
                {
                        super();
                }
-               
+
                private var _loader:HTMLLoader;
-               
+
                /**
                 *  @copy org.apache.flex.core.IBead#strand
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -319,10 +321,10 @@ package org.apache.flex.maps.google.beads
                {
                        super.strand = value;
                }
-               
+
                /**
                 *  Adjusts the map to the given coordinate and zoom level.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -332,11 +334,11 @@ package org.apache.flex.maps.google.beads
                {
 
                }
-               
+
                /**
                 *  Finds the given address and places a marker on it. This 
function may be dropped
                 *  since centerOnAddress + markCurrentLocation does the same 
thing.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -344,12 +346,12 @@ package org.apache.flex.maps.google.beads
                 */
                public function markAddress(address:String):void
                {
-                       
+
                }
-               
+
                /**
                 * Centers the map on the address given.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -357,12 +359,12 @@ package org.apache.flex.maps.google.beads
                 */
                public function centerOnAddress(address:String):void
                {
-                       
+
                }
-               
+
                /**
                 * Marks the current center of the map.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -370,13 +372,13 @@ package org.apache.flex.maps.google.beads
                 */
                public function markCurrentLocation():void
                {
-                       
+
                }
-               
+
                /**
                 * Performs a search near the center of map. The result is a 
set of
                 * markers displayed on the map.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -384,12 +386,25 @@ package org.apache.flex.maps.google.beads
                 */
                public function nearbySearch(placeName:String):void
                {
-                       
+
+               }
+
+               /**
+                * Creates a marker for placement on the map.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function createMarker(location:LatLng):Marker
+               {
+                       return null;
                }
-               
+
                /**
                 * Removes all of the markers from the map
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -397,12 +412,12 @@ package org.apache.flex.maps.google.beads
                 */
                public function removeAllMarkers():void
                {
-                       
+
                }
-               
+
                /**
                 * Sets the zoom factor of the map.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -410,26 +425,26 @@ package org.apache.flex.maps.google.beads
                 */
                public function setZoom(zoom:Number):void
                {
-                       
+
                }
-               
+
                /**
                 * Sets the center of the map.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion FlexJS 0.0
                 */
-               public function setCenter( location:Object ):void
+               public function setCenter( location:LatLng ):void
                {
-                       
+
                }
-               
+
                public function clearSearchResults():void
                {
                        // not implemented
                }
        }
-       
-}
\ No newline at end of file
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView.as
 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView.as
deleted file mode 100644
index 5cf153f..0000000
--- 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView.as
+++ /dev/null
@@ -1,515 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  Licensed to the Apache Software Foundation (ASF) under one or more
-//  contributor license agreements.  See the NOTICE file distributed with
-//  this work for additional information regarding copyright ownership.
-//  The ASF licenses this file to You under the Apache License, Version 2.0
-//  (the "License"); you may not use this file except in compliance with
-//  the License.  You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-//  Unless required by applicable law or agreed to in writing, software
-//  distributed under the License is distributed on an "AS IS" BASIS,
-//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//  See the License for the specific language governing permissions and
-//  limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-
-/**
- * NOTE
- *
- * THIS IS THE OLD MapView. The new one is GoogleMapView. This code exists to 
preserve
- * the AS/HTMLLoader version for use with AIR. Someday we will come back to 
this and make
- * it work again.
- */
-package org.apache.flex.maps.google.beads
-{
-       COMPILE::AS3 {
-               import flash.events.Event;
-               import flash.html.HTMLLoader;
-               import flash.net.URLRequest;
-       }
-
-    import org.apache.flex.core.BeadViewBase;
-       import org.apache.flex.core.IBeadModel;
-       import org.apache.flex.core.IBeadView;
-       import org.apache.flex.core.IStrand;
-       import org.apache.flex.core.UIBase;
-       import org.apache.flex.events.Event;
-       import org.apache.flex.events.IEventDispatcher;
-       import org.apache.flex.maps.google.GoogleMap;
-       import org.apache.flex.maps.google.models.MapModel;
-
-       /**
-        *  The MapView bead class displays a Google Map using HTMLLoader.
-        *
-        *  @langversion 3.0
-        *  @playerversion Flash 10.2
-        *  @playerversion AIR 2.6
-        *  @productversion FlexJS 0.0
-        */
-       COMPILE::JS
-       public class MapView extends BeadViewBase implements IBeadView
-       {
-               public function MapView()
-               {
-                       super();
-               }
-
-               private var _strand:IStrand;
-
-               override public function set strand(value:IStrand):void
-               {
-                       super.strand = value;
-                       _strand = value;
-
-                       var token:String = (_strand as GoogleMap).token;
-                       var src:String = 
'https://maps.googleapis.com/maps/api/js?v=3.exp';
-                       if (token)
-                               src += '&key=' + token;
-                       src += 
'&libraries=places&sensor=false&callback=mapInit';
-
-                       var script:HTMLScriptElement = 
document.createElement('script') as HTMLScriptElement;
-                       script.type = 'text/javascript';
-                       script.src = src;
-
-/**                    window.mapView = this;
-                       window['mapInit'] = function() {
-                               (this.mapView._strand as 
GoogleMap).finishInitialization();
-                       }
-**/
-                       document.head.appendChild(script);
-               }
-       }
-
-       COMPILE::AS3
-       public class MapView extends BeadViewBase implements IBeadView
-       {
-               /**
-                *  Constructor.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function MapView()
-               {
-               }
-
-               private var _loader:HTMLLoader;
-
-               /**
-                *  @copy org.apache.flex.core.IBead#strand
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               override public function set strand(value:IStrand):void
-               {
-                       super.strand = value;
-
-                       _loader = new HTMLLoader();
-                       _loader.x = 0;
-                       _loader.y = 0;
-                       _loader.width = UIBase(value).width;
-                       _loader.height = UIBase(value).height;
-
-                       
IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
-                       
IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
-
-                       var model:IBeadModel = 
_strand.getBeadByType(IBeadModel) as IBeadModel;
-                       model.addEventListener("zoomChanged", handleZoomChange);
-                       model.addEventListener("currentLocationChanged", 
handleCurrentLocationChange);
-
-                       (_strand as UIBase).addChild(_loader);
-
-                       var token:String = Map(_strand).token;
-                       if (token)
-                               page = pageTemplateStart + "&key=" + token + 
pageTemplateEnd;
-                       else
-                               page = pageTemplateStart + pageTemplateEnd;
-
-                       if (page) {
-                               _loader.loadString(page);
-                               
_loader.addEventListener(flash.events.Event.COMPLETE, completeHandler);
-                       }
-               }
-
-               private function completeHandler(event:flash.events.Event):void
-               {
-                       trace("htmlLoader complete");
-
-                       if (_loader && page) {
-                               _loader.window.map.center_changed = 
onMapCentered;
-                               _loader.window.map.bounds_changed = 
onMapBoundsChanged;
-                               _loader.window.map.zoom_changed   = 
onMapZoomChanged;
-                               _loader.window.map.dragend        = 
onMapDragEnd;
-
-                               // custom event handlers
-                               
_loader.window.addEventListener("searchResults",onSearchResults);
-                               
_loader.window.addEventListener("markerClicked",onMarkerClicked);
-                       }
-
-                       IEventDispatcher(_strand).dispatchEvent(new 
org.apache.flex.events.Event("ready"));
-               }
-
-               private function 
handleZoomChange(event:org.apache.flex.events.Event):void
-               {
-                       if (_loader && page) {
-                               var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
-                               setZoom(model.zoom);
-                       }
-               }
-
-               private function 
handleCurrentLocationChange(event:org.apache.flex.events.Event):void
-               {
-                       if (_loader && page) {
-                               var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
-                               setCenter(model.currentLocation.location);
-                       }
-               }
-
-               private var page:String;
-
-               /**
-                *  Adjusts the map to the given coordinate and zoom level.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function mapit(lat:Number, lng:Number, 
zoomLevel:Number):void
-               {
-                       if (_loader && page) {
-                               _loader.window.mapit(lat,lng,zoomLevel);
-                       }
-               }
-
-               /**
-                *  Finds the given address and places a marker on it. This 
function may be dropped
-                *  since centerOnAddress + markCurrentLocation does the same 
thing.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function geoCodeAndMarkAddress(address:String):void
-               {
-                       if (_loader && page) {
-                               _loader.window.codeaddress(address);
-                       }
-               }
-
-               /**
-                * Centers the map on the address given.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function centerOnAddress(address:String):void
-               {
-                       if (_loader && page) {
-                               _loader.window.centeronaddress(address);
-                       }
-               }
-
-               /**
-                * Marks the current center of the map.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function markCurrentLocation():void
-               {
-                       if (_loader && page) {
-                               _loader.window.markcurrentlocation();
-                       }
-               }
-
-               /**
-                * Performs a search near the center of map. The result is a 
set of
-                * markers displayed on the map.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function nearbySearch(placeName:String):void
-               {
-                       if (_loader && page) {
-                               _loader.window.nearbysearch(placeName);
-                       }
-               }
-
-               /**
-                * Removes all of the markers from the map
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function removeAllMarkers():void
-               {
-                       if (_loader && page) {
-                               _loader.window.clearmarkers();
-                       }
-               }
-
-               /**
-                * Sets the zoom factor of the map.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function setZoom(zoom:Number):void
-               {
-                       if (_loader && page) {
-                               _loader.window.map.setZoom(zoom);
-                       }
-               }
-
-               /**
-                * Sets the center of the map.
-                *
-                *  @langversion 3.0
-                *  @playerversion Flash 10.2
-                *  @playerversion AIR 2.6
-                *  @productversion FlexJS 0.0
-                */
-               public function setCenter( location:LatLng ):void
-               {
-                       if (_loader && page) {
-                               _loader.window.setCenter(location.lat, 
location.lng);
-                       }
-               }
-
-               /**
-                * @private
-                */
-               private function 
handleSizeChange(event:org.apache.flex.events.Event):void
-               {
-                       _loader.width = UIBase(_strand).width;
-                       _loader.height = UIBase(_strand).height;
-               }
-
-               /**
-                * @private
-                */
-               private function onMapCentered():void
-               {
-                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("centered") );
-               }
-
-               /**
-                * @private
-                */
-               private function onMapBoundsChanged():void
-               {
-                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("boundsChanged") );
-               }
-
-               /**
-                * @private
-                */
-               private function onMapZoomChanged():void
-               {
-                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("zoomChanged") );
-               }
-
-               /**
-                * @private
-                */
-               private function onMapDragEnd():void
-               {
-                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("dragEnd") );
-               }
-
-               /**
-                * @private
-                */
-               private function onSearchResults(event:*):void
-               {
-                       var results:Array = [];
-                       for(var i:int=0; i < event.results.length; i++) {
-                               var result:Place = new Place();
-                               result.geometry.location.lat = 
event.results[i].geometry.location.lat();
-                               result.geometry.location.lng = 
event.results[i].geometry.location.lng();
-                               result.icon = event.results[i].icon;
-                               result.id = event.results[i].id;
-                               result.name = event.results[i].name;
-                               result.reference = event.results[i].reference;
-                               result.vicinity = event.results[i].vicinity;
-                               results.push(result);
-                       }
-
-                       var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.searchResults = results;
-               }
-
-               /**
-                * @private
-                */
-               private function onMarkerClicked(event:*):void
-               {
-                       var marker:Marker = new Marker();
-                       marker.position.lat = event.marker.position.lat();
-                       marker.position.lng = event.marker.position.lng();
-                       marker.title = event.marker.title;
-                       marker.map = Map(_strand);
-
-                       var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
-                       model.selectedMarker = marker;
-
-                       IEventDispatcher(_strand).dispatchEvent(new 
org.apache.flex.events.Event("markerClicked"));
-               }
-
-               /**
-                * @private
-                * This page definition is used with HTMLLoader to bring in the 
Google Maps
-                * API (a Google APP token is required).
-                */
-               private static var pageTemplateStart:String = '<!DOCTYPE html>'+
-                       '<html>'+
-                       '  <head>'+
-                       '    <meta name="viewport" content="initial-scale=1.0, 
user-scalable=no" />'+
-                       '    <style type="text/css">'+
-                       '      html { height: 100% }'+
-                       '      body { height: 100%; margin: 0; padding: 0 }'+
-                       '      #map-canvas { height: 100% }'+
-                       '    </style>'+
-                       '    <script type="text/javascript"'+
-                       '      
src="https://maps.googleapis.com/maps/api/js?v=3.exp';
-
-               private static var pageTemplateEnd:String = 
'&libraries=places&sensor=false">'+
-                       '    </script>'+
-                       '    <script type="text/javascript">'+
-                       '      var map;'+
-                       '      var geocoder;'+
-                       '      var currentCenter;' +
-                       '      var service;' +
-                       '      var places;' +
-                       '      var markers;'+
-                       '      function mapit(lat, lng, zoomLevel) {' +
-                       '        currentCenter = new google.maps.LatLng(lat, 
lng);'+
-                       '        if (map == null) {' +
-                       '            var mapOptions = {'+
-                       '              center: currentCenter,'+
-                       '              zoom: zoomLevel'+
-                       '            };'+
-                       '            map = new 
google.maps.Map(document.getElementById("map-canvas"),'+
-                       '              mapOptions);' +
-                       '        }' +
-                       '        google.maps.event.addListener(map, 
"center_changed", function() {' +
-                       '            currentCenter = map.getCenter();' +
-                       '        });' +
-                       '        google.maps.event.addListener(map, 
"bounds_changed", function() {' +
-                       '            currentCenter = map.getCenter();' +
-                       '        });' +
-                       '        map.setCenter(currentCenter);'+
-                       '      };' +
-                       '      function setCenter(lat, lng) {' +
-                       '          currentCenter = new 
google.maps.LatLng(lat,lng);' +
-                       '          map.setCenter(currentCenter);' +
-                       '      };'+
-                       '      function codeaddress(address) {'+
-                       '        if (!geocoder) geocoder = new 
google.maps.Geocoder();'+
-                   '        geocoder.geocode( { "address": address}, 
function(results, status) {'+
-                       '           if (status == 
google.maps.GeocoderStatus.OK) {'+
-                       '             currentCenter = 
results[0].geometry.location;'+
-                       '             map.setCenter(currentCenter);'+
-                       '             var marker = new google.maps.Marker({'+
-                       '                map: map,'+
-                       '                position: currentCenter,'+
-                       '            });'+
-                       '            } else {'+
-                       '                alert("Geocode was not successful for 
the following reason: " + status);'+
-                       '            }'+
-                       '        });'+
-                   '      };'+
-                       '      function centeronaddress(address) {'+
-                       '        if (!geocoder) geocoder = new 
google.maps.Geocoder();'+
-                       '        geocoder.geocode( { "address": address}, 
function(results, status) {'+
-                       '          if (status == google.maps.GeocoderStatus.OK) 
{'+
-                       '             currentCenter = 
results[0].geometry.location;'+
-                       '             map.setCenter(currentCenter);' +
-                       '          } else {'+
-                       '                alert("Geocode was not successful for 
the following reason: " + status);'+
-                       '          }'+
-                       '        });'+
-                       '      };'+
-                       '      function markcurrentlocation() {'+
-                       '         createMarker(currentCenter);'+
-                       '      };' +
-                       '      function createMarker(location) {' +
-                       '         var marker = new google.maps.Marker({'+
-                       '            map: map,'+
-                       '            position: location,'+
-                       '         });' +
-                       '         google.maps.event.addListener(marker, 
"click", function() {' +
-                       '             markerClicked(marker);' +
-                       '         });'+
-                       '         return marker;'+
-                       '      };' +
-                       '      function clearmarkers() {' +
-                       '        if (markers) {' +
-                       '          for(var i=0; i < markers.length; i++) {' +
-                       '             markers[i].setMap(null);' +
-                       '          }' +
-                       '          markers = null;' +
-                       '        }' +
-                       '      };'+
-                       '      function nearbysearch(placename) {' +
-                       '         if (markers == null) markers = [];' +
-                       '         service = new 
google.maps.places.PlacesService(map);'+
-                   '         service.nearbySearch({"location": currentCenter,' 
+
-                       '           "radius": 5000,' +
-                       '           "name": placename}, function(results, 
status) {' +
-                       '              places = results;' +
-                       '              if (status == 
google.maps.places.PlacesServiceStatus.OK) {' +
-                       '                 for(var i=0; i < results.length; i++) 
{' +
-                       '                    var place = results[i];' +
-                       '                    var marker = 
createMarker(place.geometry.location);' +
-                       '                    marker.title = place.name;' +
-                       '                    markers.push(marker);' +
-                       '                 }' +
-                       '                 var event = 
document.createEvent("Event");' +
-                       '                 event.results = places;'+
-            '                 event.initEvent("searchResults", true, true);' +
-                       '                 window.dispatchEvent(event);' +
-                       '              }' +
-                       '          });'+
-                       '      };' +
-                       '      function markerClicked(marker) {' +
-                       '         var newEvent = 
document.createEvent("Event");' +
-                       '         newEvent.marker = marker;' +
-                       '         newEvent.initEvent("markerClicked", true, 
true);' +
-                       '         window.dispatchEvent(newEvent);' +
-                       '      };'+
-                       '      function initialize() {'+
-                       '        mapit(37.333, -121.900, 12);'+
-                       '      };'+
-                       '      google.maps.event.addDomListener(window, "load", 
initialize);'+
-                       '    </script>'+
-                       '  </head>'+
-                       '  <body>'+
-                       '    <div id="map-canvas"></div>'+
-                       '  </body>'+
-                       '</html>';
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView_original.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView_original.as
 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView_original.as
new file mode 100644
index 0000000..d21314e
--- /dev/null
+++ 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/beads/MapView_original.as
@@ -0,0 +1,515 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * NOTE
+ *
+ * THIS IS THE OLD MapView. The new one is GoogleMapView. This code exists to 
preserve
+ * the AS/HTMLLoader version for use with AIR. Someday we will come back to 
this and make
+ * it work again.
+ */
+package org.apache.flex.maps.google.beads
+{
+       COMPILE::AS3 {
+               import flash.events.Event;
+               import flash.html.HTMLLoader;
+               import flash.net.URLRequest;
+       }
+
+    import org.apache.flex.core.BeadViewBase;
+       import org.apache.flex.core.IBeadModel;
+       import org.apache.flex.core.IBeadView;
+       import org.apache.flex.core.IStrand;
+       import org.apache.flex.core.UIBase;
+       import org.apache.flex.events.Event;
+       import org.apache.flex.events.IEventDispatcher;
+       import org.apache.flex.maps.google.GoogleMap;
+       import org.apache.flex.maps.google.models.MapModel;
+
+       /**
+        *  The MapView bead class displays a Google Map using HTMLLoader.
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion FlexJS 0.0
+        */
+       COMPILE::JS
+       public class MapView_original extends BeadViewBase implements IBeadView
+       {
+               public function MapView_original()
+               {
+                       super();
+               }
+
+               private var _strand:IStrand;
+
+               override public function set strand(value:IStrand):void
+               {
+                       super.strand = value;
+                       _strand = value;
+
+                       var token:String = (_strand as GoogleMap).token;
+                       var src:String = 
'https://maps.googleapis.com/maps/api/js?v=3.exp';
+                       if (token)
+                               src += '&key=' + token;
+                       src += 
'&libraries=places&sensor=false&callback=mapInit';
+
+                       var script:HTMLScriptElement = 
document.createElement('script') as HTMLScriptElement;
+                       script.type = 'text/javascript';
+                       script.src = src;
+
+/**                    window.mapView = this;
+                       window['mapInit'] = function() {
+                               (this.mapView._strand as 
GoogleMap).finishInitialization();
+                       }
+**/
+                       document.head.appendChild(script);
+               }
+       }
+
+       COMPILE::AS3
+       public class MapView_original extends BeadViewBase implements IBeadView
+       {
+               /**
+                *  Constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function MapView_original()
+               {
+               }
+
+               private var _loader:HTMLLoader;
+
+               /**
+                *  @copy org.apache.flex.core.IBead#strand
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               override public function set strand(value:IStrand):void
+               {
+                       super.strand = value;
+
+                       _loader = new HTMLLoader();
+                       _loader.x = 0;
+                       _loader.y = 0;
+                       _loader.width = UIBase(value).width;
+                       _loader.height = UIBase(value).height;
+
+                       
IEventDispatcher(_strand).addEventListener("widthChanged",handleSizeChange);
+                       
IEventDispatcher(_strand).addEventListener("heightChanged",handleSizeChange);
+
+                       var model:IBeadModel = 
_strand.getBeadByType(IBeadModel) as IBeadModel;
+                       model.addEventListener("zoomChanged", handleZoomChange);
+                       model.addEventListener("currentLocationChanged", 
handleCurrentLocationChange);
+
+                       (_strand as UIBase).addChild(_loader);
+
+                       var token:String = Map(_strand).token;
+                       if (token)
+                               page = pageTemplateStart + "&key=" + token + 
pageTemplateEnd;
+                       else
+                               page = pageTemplateStart + pageTemplateEnd;
+
+                       if (page) {
+                               _loader.loadString(page);
+                               
_loader.addEventListener(flash.events.Event.COMPLETE, completeHandler);
+                       }
+               }
+
+               private function completeHandler(event:flash.events.Event):void
+               {
+                       trace("htmlLoader complete");
+
+                       if (_loader && page) {
+                               _loader.window.map.center_changed = 
onMapCentered;
+                               _loader.window.map.bounds_changed = 
onMapBoundsChanged;
+                               _loader.window.map.zoom_changed   = 
onMapZoomChanged;
+                               _loader.window.map.dragend        = 
onMapDragEnd;
+
+                               // custom event handlers
+                               
_loader.window.addEventListener("searchResults",onSearchResults);
+                               
_loader.window.addEventListener("markerClicked",onMarkerClicked);
+                       }
+
+                       IEventDispatcher(_strand).dispatchEvent(new 
org.apache.flex.events.Event("ready"));
+               }
+
+               private function 
handleZoomChange(event:org.apache.flex.events.Event):void
+               {
+                       if (_loader && page) {
+                               var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
+                               setZoom(model.zoom);
+                       }
+               }
+
+               private function 
handleCurrentLocationChange(event:org.apache.flex.events.Event):void
+               {
+                       if (_loader && page) {
+                               var model:MapModel = 
_strand.getBeadByType(IBeadModel) as MapModel;
+                               setCenter(model.currentLocation.location);
+                       }
+               }
+
+               private var page:String;
+
+               /**
+                *  Adjusts the map to the given coordinate and zoom level.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function mapit(lat:Number, lng:Number, 
zoomLevel:Number):void
+               {
+                       if (_loader && page) {
+                               _loader.window.mapit(lat,lng,zoomLevel);
+                       }
+               }
+
+               /**
+                *  Finds the given address and places a marker on it. This 
function may be dropped
+                *  since centerOnAddress + markCurrentLocation does the same 
thing.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function geoCodeAndMarkAddress(address:String):void
+               {
+                       if (_loader && page) {
+                               _loader.window.codeaddress(address);
+                       }
+               }
+
+               /**
+                * Centers the map on the address given.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function centerOnAddress(address:String):void
+               {
+                       if (_loader && page) {
+                               _loader.window.centeronaddress(address);
+                       }
+               }
+
+               /**
+                * Marks the current center of the map.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function markCurrentLocation():void
+               {
+                       if (_loader && page) {
+                               _loader.window.markcurrentlocation();
+                       }
+               }
+
+               /**
+                * Performs a search near the center of map. The result is a 
set of
+                * markers displayed on the map.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function nearbySearch(placeName:String):void
+               {
+                       if (_loader && page) {
+                               _loader.window.nearbysearch(placeName);
+                       }
+               }
+
+               /**
+                * Removes all of the markers from the map
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function removeAllMarkers():void
+               {
+                       if (_loader && page) {
+                               _loader.window.clearmarkers();
+                       }
+               }
+
+               /**
+                * Sets the zoom factor of the map.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function setZoom(zoom:Number):void
+               {
+                       if (_loader && page) {
+                               _loader.window.map.setZoom(zoom);
+                       }
+               }
+
+               /**
+                * Sets the center of the map.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion FlexJS 0.0
+                */
+               public function setCenter( location:LatLng ):void
+               {
+                       if (_loader && page) {
+                               _loader.window.setCenter(location.lat, 
location.lng);
+                       }
+               }
+
+               /**
+                * @private
+                */
+               private function 
handleSizeChange(event:org.apache.flex.events.Event):void
+               {
+                       _loader.width = UIBase(_strand).width;
+                       _loader.height = UIBase(_strand).height;
+               }
+
+               /**
+                * @private
+                */
+               private function onMapCentered():void
+               {
+                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("centered") );
+               }
+
+               /**
+                * @private
+                */
+               private function onMapBoundsChanged():void
+               {
+                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("boundsChanged") );
+               }
+
+               /**
+                * @private
+                */
+               private function onMapZoomChanged():void
+               {
+                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("zoomChanged") );
+               }
+
+               /**
+                * @private
+                */
+               private function onMapDragEnd():void
+               {
+                       IEventDispatcher(_strand).dispatchEvent( new 
org.apache.flex.events.Event("dragEnd") );
+               }
+
+               /**
+                * @private
+                */
+               private function onSearchResults(event:*):void
+               {
+                       var results:Array = [];
+                       for(var i:int=0; i < event.results.length; i++) {
+                               var result:Place = new Place();
+                               result.geometry.location.lat = 
event.results[i].geometry.location.lat();
+                               result.geometry.location.lng = 
event.results[i].geometry.location.lng();
+                               result.icon = event.results[i].icon;
+                               result.id = event.results[i].id;
+                               result.name = event.results[i].name;
+                               result.reference = event.results[i].reference;
+                               result.vicinity = event.results[i].vicinity;
+                               results.push(result);
+                       }
+
+                       var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
+                       model.searchResults = results;
+               }
+
+               /**
+                * @private
+                */
+               private function onMarkerClicked(event:*):void
+               {
+                       var marker:Marker = new Marker();
+                       marker.position.lat = event.marker.position.lat();
+                       marker.position.lng = event.marker.position.lng();
+                       marker.title = event.marker.title;
+                       marker.map = Map(_strand);
+
+                       var model:MapModel = _strand.getBeadByType(IBeadModel) 
as MapModel;
+                       model.selectedMarker = marker;
+
+                       IEventDispatcher(_strand).dispatchEvent(new 
org.apache.flex.events.Event("markerClicked"));
+               }
+
+               /**
+                * @private
+                * This page definition is used with HTMLLoader to bring in the 
Google Maps
+                * API (a Google APP token is required).
+                */
+               private static var pageTemplateStart:String = '<!DOCTYPE html>'+
+                       '<html>'+
+                       '  <head>'+
+                       '    <meta name="viewport" content="initial-scale=1.0, 
user-scalable=no" />'+
+                       '    <style type="text/css">'+
+                       '      html { height: 100% }'+
+                       '      body { height: 100%; margin: 0; padding: 0 }'+
+                       '      #map-canvas { height: 100% }'+
+                       '    </style>'+
+                       '    <script type="text/javascript"'+
+                       '      
src="https://maps.googleapis.com/maps/api/js?v=3.exp';
+
+               private static var pageTemplateEnd:String = 
'&libraries=places&sensor=false">'+
+                       '    </script>'+
+                       '    <script type="text/javascript">'+
+                       '      var map;'+
+                       '      var geocoder;'+
+                       '      var currentCenter;' +
+                       '      var service;' +
+                       '      var places;' +
+                       '      var markers;'+
+                       '      function mapit(lat, lng, zoomLevel) {' +
+                       '        currentCenter = new google.maps.LatLng(lat, 
lng);'+
+                       '        if (map == null) {' +
+                       '            var mapOptions = {'+
+                       '              center: currentCenter,'+
+                       '              zoom: zoomLevel'+
+                       '            };'+
+                       '            map = new 
google.maps.Map(document.getElementById("map-canvas"),'+
+                       '              mapOptions);' +
+                       '        }' +
+                       '        google.maps.event.addListener(map, 
"center_changed", function() {' +
+                       '            currentCenter = map.getCenter();' +
+                       '        });' +
+                       '        google.maps.event.addListener(map, 
"bounds_changed", function() {' +
+                       '            currentCenter = map.getCenter();' +
+                       '        });' +
+                       '        map.setCenter(currentCenter);'+
+                       '      };' +
+                       '      function setCenter(lat, lng) {' +
+                       '          currentCenter = new 
google.maps.LatLng(lat,lng);' +
+                       '          map.setCenter(currentCenter);' +
+                       '      };'+
+                       '      function codeaddress(address) {'+
+                       '        if (!geocoder) geocoder = new 
google.maps.Geocoder();'+
+                   '        geocoder.geocode( { "address": address}, 
function(results, status) {'+
+                       '           if (status == 
google.maps.GeocoderStatus.OK) {'+
+                       '             currentCenter = 
results[0].geometry.location;'+
+                       '             map.setCenter(currentCenter);'+
+                       '             var marker = new google.maps.Marker({'+
+                       '                map: map,'+
+                       '                position: currentCenter,'+
+                       '            });'+
+                       '            } else {'+
+                       '                alert("Geocode was not successful for 
the following reason: " + status);'+
+                       '            }'+
+                       '        });'+
+                   '      };'+
+                       '      function centeronaddress(address) {'+
+                       '        if (!geocoder) geocoder = new 
google.maps.Geocoder();'+
+                       '        geocoder.geocode( { "address": address}, 
function(results, status) {'+
+                       '          if (status == google.maps.GeocoderStatus.OK) 
{'+
+                       '             currentCenter = 
results[0].geometry.location;'+
+                       '             map.setCenter(currentCenter);' +
+                       '          } else {'+
+                       '                alert("Geocode was not successful for 
the following reason: " + status);'+
+                       '          }'+
+                       '        });'+
+                       '      };'+
+                       '      function markcurrentlocation() {'+
+                       '         createMarker(currentCenter);'+
+                       '      };' +
+                       '      function createMarker(location) {' +
+                       '         var marker = new google.maps.Marker({'+
+                       '            map: map,'+
+                       '            position: location,'+
+                       '         });' +
+                       '         google.maps.event.addListener(marker, 
"click", function() {' +
+                       '             markerClicked(marker);' +
+                       '         });'+
+                       '         return marker;'+
+                       '      };' +
+                       '      function clearmarkers() {' +
+                       '        if (markers) {' +
+                       '          for(var i=0; i < markers.length; i++) {' +
+                       '             markers[i].setMap(null);' +
+                       '          }' +
+                       '          markers = null;' +
+                       '        }' +
+                       '      };'+
+                       '      function nearbysearch(placename) {' +
+                       '         if (markers == null) markers = [];' +
+                       '         service = new 
google.maps.places.PlacesService(map);'+
+                   '         service.nearbySearch({"location": currentCenter,' 
+
+                       '           "radius": 5000,' +
+                       '           "name": placename}, function(results, 
status) {' +
+                       '              places = results;' +
+                       '              if (status == 
google.maps.places.PlacesServiceStatus.OK) {' +
+                       '                 for(var i=0; i < results.length; i++) 
{' +
+                       '                    var place = results[i];' +
+                       '                    var marker = 
createMarker(place.geometry.location);' +
+                       '                    marker.title = place.name;' +
+                       '                    markers.push(marker);' +
+                       '                 }' +
+                       '                 var event = 
document.createEvent("Event");' +
+                       '                 event.results = places;'+
+            '                 event.initEvent("searchResults", true, true);' +
+                       '                 window.dispatchEvent(event);' +
+                       '              }' +
+                       '          });'+
+                       '      };' +
+                       '      function markerClicked(marker) {' +
+                       '         var newEvent = 
document.createEvent("Event");' +
+                       '         newEvent.marker = marker;' +
+                       '         newEvent.initEvent("markerClicked", true, 
true);' +
+                       '         window.dispatchEvent(newEvent);' +
+                       '      };'+
+                       '      function initialize() {'+
+                       '        mapit(37.333, -121.900, 12);'+
+                       '      };'+
+                       '      google.maps.event.addDomListener(window, "load", 
initialize);'+
+                       '    </script>'+
+                       '  </head>'+
+                       '  <body>'+
+                       '    <div id="map-canvas"></div>'+
+                       '  </body>'+
+                       '</html>';
+       }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/models/MapModel.as
----------------------------------------------------------------------
diff --git 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/models/MapModel.as
 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/models/MapModel.as
index d988e3b..6184143 100644
--- 
a/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/models/MapModel.as
+++ 
b/frameworks/projects/GoogleMaps/as/src/org/apache/flex/maps/google/models/MapModel.as
@@ -22,17 +22,15 @@ package org.apache.flex.maps.google.models
        import org.apache.flex.core.IStrand;
        import org.apache.flex.events.Event;
        import org.apache.flex.events.EventDispatcher;
-       
-       COMPILE::JS {
-               import google.maps.LatLng;
-               import google.maps.Marker;
-       }
-       
+
+       import google.maps.LatLng;
+       import google.maps.Marker;
+
        /**
         * The data model for the Map class, this holds the maps current center
         * location, its current zoom level, the last marker selected, and any
         * search results.
-        *  
+        *
         *  @langversion 3.0
         *  @playerversion Flash 10.2
         *  @playerversion AIR 2.6
@@ -42,7 +40,7 @@ package org.apache.flex.maps.google.models
        {
                /**
                 * Constructor.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -52,12 +50,12 @@ package org.apache.flex.maps.google.models
                {
                        super();
                }
-               
+
                private var _strand:IStrand;
-               
+
                /**
                 *  @copy org.apache.flex.core.IBead#strand
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -67,9 +65,9 @@ package org.apache.flex.maps.google.models
                {
                        _strand = value;
                }
-               
+
                private var _token:String;
-               
+
                public function get token():String
                {
                        return _token;
@@ -79,60 +77,54 @@ package org.apache.flex.maps.google.models
                        _token = value;
                        dispatchEvent(new Event("tokenChanged"));
                }
-               
-               COMPILE::JS
+
                private var _currentCenter:LatLng;
-               
+
                /**
                 * The current center of the map.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion FlexJS 0.0
                 */
-               COMPILE::JS
                public function get currentCenter():LatLng
                {
                        return _currentCenter;
                }
-               
-               COMPILE::JS
+
                public function set currentCenter(value:LatLng):void
                {
                        _currentCenter = value;
                        dispatchEvent( new Event("currentCenterChanged") );
                }
-               
-               COMPILE::JS
+
                private var _selectedMarker:Marker;
-               
+
                /**
                 * The last marker selected, if any.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
                 *  @productversion FlexJS 0.0
                 */
-               COMPILE::JS
                public function get selectedMarker():Marker
                {
                        return _selectedMarker;
                }
-               
-               COMPILE::JS
+
                public function set selectedMarker(value:Marker):void
                {
                        _selectedMarker = value;
                        dispatchEvent( new Event("selectedMarkerChanged") );
                }
-               
+
                private var _zoom:Number;
-               
+
                /**
                 * The current zoom level.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -149,12 +141,12 @@ package org.apache.flex.maps.google.models
                                dispatchEvent( new Event("zoomChanged") );
                        }
                }
-               
+
                private var _searchResults:Array;
-               
+
                /**
                 * Results from the last search.
-                *  
+                *
                 *  @langversion 3.0
                 *  @playerversion Flash 10.2
                 *  @playerversion AIR 2.6
@@ -170,4 +162,4 @@ package org.apache.flex.maps.google.models
                        dispatchEvent( new Event("searchResultsChanged") );
                }
        }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/325df7b0/frameworks/projects/GoogleMaps/google-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/GoogleMaps/google-manifest.xml 
b/frameworks/projects/GoogleMaps/google-manifest.xml
index a9138df..f843c0c 100644
--- a/frameworks/projects/GoogleMaps/google-manifest.xml
+++ b/frameworks/projects/GoogleMaps/google-manifest.xml
@@ -20,5 +20,5 @@
 
 
 <componentPackage>
-    <component id="GoogleMap" class="org.apache.flex.maps.google.GoogleMap" />
+    <component id="Map" class="org.apache.flex.maps.google.GoogleMap" />
 </componentPackage>

Reply via email to