1 Reply Latest reply on Dec 16, 2010 1:04 PM by VK_ADOBEFLEX

    Help with BirdsEyeManager button(bing map)

    costache.cristina

      Hy,

      I'm having a problem with the BirdsEye button. I'm trying to do a small application with flex,

      and I want to use bing map service. Everything was fine except the BirdsEye button integration.

      When I'm trying to run the application, the AIR platform throws me an exception, and I dont know

      where the problem is.

       

      Here is the code:

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"

                                              creationComplete="init()">

      <mx:Script>

      <![CDATA[

           import com.afcomponents.umap.display.geocodermanager.BingSearchService;

           import com.afcomponents.umap.display.birdseye.BirdsEyeManager;

           import com.afcomponents.umap.gui.*;

           import mx.core.UIComponent;

           import com.afcomponents.umap.core.UMap;

          import com.afcomponents.umap.providers.microsoft.MapPointProxy;

         import com.afcomponents.umap.providers.microsoft.BingProvider;

         import com.afcomponents.umap.providers.microsoft.BingEnvironment;

         import com.afcomponents.umap.gui.BingControl;

         import com.afcomponents.umap.display.birdseye.BirdsEyeManager;

         import com.afcomponents.umap.interfaces.IManager;

         import fl.controls.Button;

         import com.afcomponents.umap.interfaces.IMapControl;

       

          private var map:UMap;

           private var container:UIComponent;

           private var button:Button;

           private var birdseye:BirdsEyeManager;

       

       

           public function init() : void {

                container = new UIComponent();

                map = new UMap();

                map.setSize(700, 500);

                container.addChild(map);

                mapCanvas.addChild(container);

                container.focusManager.deactivate();

       

                map.addControl(new BingControl());

                map.setZoom(4);

       

       

                // initialize proxy

                     MapPointProxy.initialize("http://www.umapper.com/demo/dmitry/msproxy.php");

         

                // select bing environement

                     BingEnvironment.type = BingEnvironment.STAGING;

       

                // select Bing provider & aerial map type

                  map.setProvider(new BingProvider());

                  map.setMapType(BingProvider.ROAD);

       

             // add birdseye button

                  button = new Button();

                  button.label = "";

                  button.enabled = false;

                  button.x = button.y = 10;

                  container.addChild(button);

       

             // initialize birds eye manager

                  birdseye = new BirdsEyeManager();

                  map.addManager(birdseye);

       

             // listen for birds eye status change

                  birdseye.addEventListener(Event.CHANGE, birdseyeUpdate);

       

             // add click handler to button

                  button.addEventListener(MouseEvent.CLICK, buttonClick);

           }

       

       

           public function birdseyeUpdate(event:Event):void {

              trace("Birds eye changed, available: " + birdseye.available);

              button.enabled = birdseye.available;

          }

       

          public function buttonClick(event:MouseEvent):void {

              // select bird's eye map type

                   map.setMapType(birdseye.mapType);

         }

      ]]>

      </mx:Script>

       

      <mx:Canvas id="mapCanvas" x="395" y="173"/>

      </mx:WindowedApplication>

       

      Everything works fine, and the birdseye button works too, but I dont understand the exception.

       

      [SWF] bingmap.swf - 1,509,964 bytes after decompression

      TypeError: Error #2007: Parameter child must be non-null.

      at flash.display::DisplayObjectContainer/addChildAt()

      at fl.controls::BaseButton/drawBackground()

      at fl.controls::LabelButton/draw()

      at fl.controls::Button/draw()

      at fl.core::UIComponent/callLaterDispatcher()

      I need some answers.
      Thanks,