3 Replies Latest reply on Sep 10, 2008 5:40 AM by Newsgroup_User

    Type not found or was not a compile time constant:MapEvent

    hvswathi
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      width="800" height="600"
      backgroundColor="#FFFFFF"
      initialize="init()">

      <mx:Script>
      <![CDATA[
      import com.google.maps.Map;
      import com.google.maps.MapEvent;
      import com.google.maps.MapType;
      import com.google.maps.LatLng;

      private var _map:Map;

      private function init():void
      {
      _map = new Map();
      _map.key = "your key here";
      _map.addEventListener(MapEvent.MAP_READY, onMapReady);
      _map.setSize( new Point (this.width, this.height))
      mapContainer.addChild(_map);
      }

      private function onMapReady(event:MapEvent):void
      {
      _map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
      }


      ]]>
      </mx:Script>

      <mx:UIComponent id="mapContainer" width="100%" height="100%"/>
      </mx:Application>

      this is the code which i want to excecute
        • 1. Re: Type not found or was not a compile time constant:MapEvent
          Level 7

          "hvswathi" <webforumsuser@macromedia.com> wrote in message
          news:ga2k9i$2j9$1@forums.macromedia.com...
          > <?xml version="1.0" encoding="utf-8"?>
          > <mx:Application
          > xmlns:mx=" http://www.adobe.com/2006/mxml"
          > width="800" height="600"
          > backgroundColor="#FFFFFF"
          > initialize="init()">
          >
          > <mx:Script>
          > <![CDATA[
          > import com.google.maps.Map;
          > import com.google.maps.MapEvent;
          > import com.google.maps.MapType;
          > import com.google.maps.LatLng;
          >
          > private var _map:Map;
          >
          > private function init():void
          > {
          > _map = new Map();
          > _map.key = "your key here";
          > _map.addEventListener(MapEvent.MAP_READY, onMapReady);
          > _map.setSize( new Point (this.width, this.height))
          > mapContainer.addChild(_map);
          > }
          >
          > private function onMapReady(event:MapEvent):void
          > {
          > _map.setCenter(new LatLng(40.736072,-73.992062), 14,
          > MapType.NORMAL_MAP_TYPE);
          > }
          >
          >
          > ]]>
          > </mx:Script>
          >
          > <mx:UIComponent id="mapContainer" width="100%" height="100%"/>
          > </mx:Application>
          >
          > this is the code which i want to excecute

          What line caused the error?


          • 2. Re: Type not found or was not a compile time constant:MapEvent
            hvswathi Level 1
            map.addEventListener(MapEvent.MAP_READY, onMapReady);
            This line is giving the error saying that "type not found:mapEvent"

            Do i need to add any library.
            • 3. Re: Type not found or was not a compile time constant:MapEvent
              Level 7

              "hvswathi" <webforumsuser@macromedia.com> wrote in message
              news:ga88pf$7d$1@forums.macromedia.com...
              > map.addEventListener(MapEvent.MAP_READY, onMapReady);
              > This line is giving the error saying that "type not found:mapEvent"

              Is the class for this in the folder where it's supposed to be? And it looks
              like the error has a different case than your code. Is it possible you're
              mistaking which line it's attached to? Is there another line where you
              reference mapEvent instead of MapEvent?