1

i am trying to create multiple markers on google maps using action script for flex mobile project 4.5

this is the code from where im passing the cities and which will load the google maps

        import spark.events.ViewNavigatorEvent;


        private var myWebView:StageWebView;
        private var city:String;

        /**
         * @protected 
         * Just add and set site of my StageWebView 
         * */

        protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
        {

            // set the city with data default property of each view

            city = data.toString();

             myWebView = new StageWebView();
             myWebView.stage = this.stage;
            // myWebView.loadURL("http://maps.google.com"); // default
             myWebView.loadURL("http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q="+ city + "&z=12&sensor=true");

             myWebView.viewPort = new Rectangle(0,70,stage.stageWidth,stage.stageHeight);
        }


        /** 
         * @private
         *  
         * Just override to re-scale due to auto-orientation project nature
         * */
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {


            if (myWebView) {
                var point:Point = localToGlobal(new Point());
                myWebView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);
            }
        }   
        override protected function stateChanged(oldState:String, newState:String, recursive:Boolean):void
        {

        }

        protected function goBackHandler(event:MouseEvent):void
        {

            navigator.popToFirstView();

        }

        protected function removeStageWebViewHandler(event:ViewNavigatorEvent):void
        {
            myWebView.stage = null;
            // just remove the target and will leave.

        }


    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:navigationContent>
    <s:Button label="Go Back" click="goBackHandler(event)"/>
</s:navigationContent>

i want to pass cities by storing all the cities in array and display all the cities(marker) protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void {

        // set the city with data default property of each view

        city = data.toString();

         myWebView = new StageWebView();
         myWebView.stage = this.stage;
        // myWebView.loadURL("http://maps.google.com"); // default
         myWebView.loadURL("http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q="+ city + "&z=12&sensor=true");

         myWebView.viewPort = new Rectangle(0,70,stage.stageWidth,stage.stageHeight);
    }

plz help

ketan
  • 19,129
  • 42
  • 60
  • 98
francis dcunha
  • 55
  • 3
  • 11

1 Answers1

0

use

myWebView.loadURL("http://maps.googleapis.com/maps/api/staticmap?f=q&source=s_q&hl=en&geocode=&center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false&z=12&sensor=true");

and this will create multiple marker on flex mobile app page

Sam Kaz
  • 432
  • 3
  • 12