2 Replies Latest reply on Sep 18, 2010 2:33 PM by Miggl

    Yahoo! Maps prevent module from loading!?

    Miggl Level 1

      Hi All,

       

      I'm trying to implement a map control in Flex 4, and thought Yahoo! Maps would be a good place to start (please do suggest a better alternative, if you know one).

       

      I have my map control in a module. The module load fine without the Yahoo map being declared, however, when I add the map variable it doesn't load. Here is the code:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Module
           xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" 
           xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" 
           width="100%" height="600" cornerRadius="10"
      >
           <mx:states>
           </mx:states>
           <fx:Declarations>
           </fx:Declarations>
           <fx:Script>
                <![CDATA[
                     import com.yahoo.maps.api.YahooMap;
                     import mx.events.FlexEvent;
      
                     private var map:YahooMap; //comment this line out, and the module loads fine
      /*               private var mapId:String = "xxxxxx";
      
                     private function mdl_jobs_creationCompleteHandler(event:FlexEvent):void
                     {
                          this.map = new YahooMap();
                          this.map.init(this.mapId, 100, 100);
                          this.ui_container.addChild(map);
                     }
      */
                ]]>
           </fx:Script>
           <s:Label text="test" />
           <s:BorderContainer id="ui_container" width="100%" height="100%">
           </s:BorderContainer>
      </mx:Module>
      
      

       

      Any suggestions?

       

      Thanks!

        • 1. Re: Yahoo! Maps prevent module from loading!?
          Miggl Level 1

          Just as a follow-up: it seems this behaviour presents itself with the Google Map API as well.

           

          Has anyone been able to get Google or Yahoo map APIs working in Flex 4?

           

          Update: I'm wondering if this is not a problem with my project configuration, because I cannot get any map controls to work. Any idea what might cause this? I've tried Yahoo Maps, Google Maps, Modest Maps ...

          • 2. Re: Yahoo! Maps prevent module from loading!?
            Miggl Level 1

            Here's something that may prove useful to helping solve this problem:

             

            I downloaded the source for ModestMaps and used it instead of the pre-compiled SWF file, and it worked! This tells me there is something amiss with the way SWF are treated in my project (I added them to the libs folder in my project).

             

            Any ideas on what needs to be done to fix that?

             

            Thanks!