2 Replies Latest reply on Aug 22, 2007 8:23 AM by kilyas2007

    flex 2 and yahoo maps

    kilyas2007
      As you would all know, atleast who have been working with yahoo maps, that yahoo maps API is not compatible with flex 2, since it doesn't support actionscript 3. So technically you cannot import the swc file in your flex builder project. Since I was working on a project which had to use flex maps, I used information from

      http://weblog.cahlan.com/2006/09/yahoo-maps-in-flex-2-as3.html

      to basically have a workaround. However there is a catch, apparently I cannot add markers to the map. I am using the following code to zoom and center on a particular location:-

      sendData("setCenterByAddressAndZoom", arrAddress.join(",") + ":~:6:~:0");

      I thought of suing something like

      sendData("sendData("setCenterByAddressAndZoom",....

      but the problem is that if you look at the signature of the method in the API,

      addMarkerByAddress(markerClass, address, data)

      now the marker class is not available to me since I don't/can't have the swc file in lib. Is there any work around for this?
        • 1. flex 2 and yahoo maps
          rotoole Level 1
          the .swc worked in Flex 1.5 but no support for Flex 2.0. what you're going to need is to download this AS3 communication kit. the Yahoo! Map is in AS2 and the we're in AS3 sooo...theres some external interfacing going on. its really not that tricky once you wrap your head around whats going on between the two and get your data/objects set up the right way.

          http://developer.yahoo.com/flash/astra-webapis/#maps

          http://developer.yahoo.com/maps/flash/V3.5/flashReference.html

          you might want to join this Yahoo group, pretty much all the support you're going to find is there
          http://tech.groups.yahoo.com/group/yws-maps-flash/
          • 2. Re: flex 2 and yahoo maps
            kilyas2007 Level 1
            Thanx rotoole, I just downloaded the AS3 communication kit and was trying to run a sample app. which looks something like :-
            <mx:Application

            xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:yahoo="com.yahoo.webapis.maps.*"

            layout="absolute">

            <mx:Script>

            <![CDATA[

            import flash.utils.getTimer;



            private const SWFDOMID:String = "YahooAS3Maps";

            private const UNIQUEID:int = getTimer();

            private const YAHOOAPIKEY:String = "3opdC67V34Hdl7SaFGL7Fs8o33uM0IdKMuN5aNbhLAoNfPqmHq78y_u8daqjzVpgLw--";

            private const MAPSWF:String = "as2map.swf";

            ]]>

            </mx:Script>

            <yahoo:YahooMapService id="swfLoader" UUID="{UNIQUEID}"

            swfDomId="{SWFDOMID}" apiId="{YAHOOAPIKEY}" mapURL = "{MAPSWF}"

            horizontalCenter="0" verticalCenter="0" width="600" height="400" />

            </mx:Application>


            Now I am not sure if the API key I am putting is correct or not, most probably its not since when I run the app I see no maps but a bitmap of maps. I am trying to get the key from

            https://developer.yahoo.com/wsregapp/index.php

            Is the key same for all the API's?

            secondly does the website URL while getting teh key need to be the one where the request is coming from, since in this case I am building a demo on my desktop, this is really running me crazy any help would be greatly appreciated.