Problem to display 3D google map.

Posted by nemade-vipin on Stack Overflow See other posts from Stack Overflow or by nemade-vipin
Published on 2010-04-17T08:46:37Z Indexed on 2010/04/17 8:53 UTC
Read the original article Hit count: 587

Filed under:
|

hello friends, I have implemented one Flex application in which I want to display 3D google map.In which I am getting the error the NUll object reference during map display.

Here is my code:-

   import com.google.maps.controls.MapTypeControl;
   import adobe.utils.XMLUI;
   import mx.rpc.events.FaultEvent;
   import mx.controls.Alert;
   import generated.webservices.*;
   import mx.collections.ArrayCollection;
   import mx.controls.*;
   import generated.webservices.*;
   import com.google.maps.LatLng; 

import com.google.maps.Map3D; import com.google.maps.MapEvent; import com.google.maps.MapMouseEvent; import com.google.maps.services.GeocodingEvent; import com.google.maps.services.ClientGeocoder; import com.google.maps.overlays.Marker; import com.google.maps.InfoWindowOptions; import com.google.maps.MapOptions; import com.google.maps.MapType; import com.google.maps.View; import com.google.maps.controls.NavigationControl; import com.google.maps.geom.Attitude; import mx.controls.Alert;

     [Bindable]
        private var childName:ArrayCollection;
     [Bindable]
        private var childId:ArrayCollection;  
        private var photoFeed:ArrayCollection;
        private var trackinginfochild:TrackingInfo;
        private var arrayOfchild:Array;
        private var newEntry:GetSBTSMobileAuthentication;
        private var trackinginfo:GetSBTSTrackingInfo;
        private var childObj:Child;
        private var UserId:int;
        private var lat:int;
        private var long:int;
        private var latlong:LatLng; 
    public var user:SBTSWebService;


    public function authentication():void
    {
           // Instantiate a new Entry object.
            user = new SBTSWebService();
            if(user!=null)
            {
            user.addSBTSWebServiceFaultEventListener(handleFaults);
            user.addgetSBTSMobileAuthenticationEventListener(authenticationResult);

            newEntry = new GetSBTSMobileAuthentication(); 
                if(newEntry!=null)
                {
                newEntry.mobile=mobileno.text;
                newEntry.password=password.text;
                user.getSBTSMobileAuthentication(newEntry);
                }
            }

    }

    public function handleFaults(event:FaultEvent):void
    {
        Alert.show("A fault occured contacting the server. Fault message is: " + event.fault.faultString);
    }

    public function authenticationResult(event:GetSBTSMobileAuthenticationResultEvent):void
    {
        if(event.result != null && event.result._return>0) 
        {

           if(event.result._return > 0)
           {
              UserId = event.result._return;
             loginform.enabled = false;
              getChildList(UserId);       
              viewstack2.selectedIndex=1;
           }
           else
           {
             Alert.show("Authentication fail");
           }


        }

    }
  public function getChildList(userId:int):void
  {
     var childEntry:GetSBTSMobileChildrenInfo = new GetSBTSMobileChildrenInfo();
     childEntry.UserId = userId;
     user.addgetSBTSMobileChildrenInfoEventListener(sbtsChildrenInfoResult);
     user.getSBTSMobileChildrenInfo(childEntry);
  }
   public function sbtsChildrenInfoResult(event:GetSBTSMobileChildrenInfoResultEvent):void
    {
        if( event.result._return!=null) 
        {

        arrayOfchild  = event.result._return as Array;
        photoFeed = new ArrayCollection(arrayOfchild);
        childName = new ArrayCollection();


       for( var count:int=0;count<photoFeed.length;count++)
       {
           childObj = photoFeed.getItemAt(count,0) as Child;
           childName.addItem(childObj.strName); 


       }


        }

    }

private function trackingInfo():void { for( var count:int=0;count user.getSBTSTrackingInfo(trackinginfo);

                }
              }
           }

}

private function getTrackingInfo(event:GetSBTSTrackingInfoResultEvent):void { if(event.result._return != null) { trackinginfochild = event.result._return as TrackingInfo; lat = trackinginfochild.dblLatitude; long = trackinginfochild.dblLongitude; latlong = new LatLng(lat,long); } }

private function onMapPreinitialize(event:MapEvent):void { 
var myMapOptions:MapOptions = new MapOptions(); 
myMapOptions.zoom = 12; 
myMapOptions.center =  latlong;
myMapOptions.mapType = MapType.NORMAL_MAP_TYPE; 
myMapOptions.viewMode = View.VIEWMODE_PERSPECTIVE; 
myMapOptions.attitude = new Attitude(20,30,0); 
buslocation.setInitOptions(myMapOptions); 
buspath.setInitOptions(myMapOptions);

} private function onMapReady(event:MapEvent):void { this.buslocation.addControl(new NavigationControl()); this.buslocation.addControl( new MapTypeControl());

}

]]>

<mx:Move id="hideEffect"
    yTo="-500" />
<mx:Move id="showEffect"
    xFrom="500"/>
<mx:Panel width="100%" height="100%"
    headerColors="[#000000,#FFFFFF]" hideEffect="{hideEffect}" showEffect="{showEffect}">

    <mx:TabNavigator id="viewstack2" selectedIndex="0" creationPolicy="all" 
    width="100%" height="100%"> 
        <mx:Form label="Login Form" id="loginform" hideEffect="{hideEffect}" showEffect="{showEffect}">
         <mx:FormItem label="Mobile NO:" creationPolicy="all">
            <mx:TextInput id="mobileno"/>
         </mx:FormItem>
        <mx:FormItem label="Password:" creationPolicy="all">
            <mx:TextInput displayAsPassword="true" id="password" />
       </mx:FormItem>
        <mx:FormItem>
            <mx:Button label="Login" click="authentication()"/>
       </mx:FormItem>
        </mx:Form>


           <mx:Form label="Child List" id="childForm" hideEffect="{hideEffect}" showEffect="{showEffect}">
              <mx:Label width="100%" color="blue" 
                   text="Select Child."/>


              <mx:RadioButtonGroup id="radioGroup" itemClick="trackingInfo()"/>
                 <mx:Repeater id="fieldRepeater" 
                                dataProvider="{childName}">
                                <mx:RadioButton groupName="radioGroup" 
                                            label="{fieldRepeater.currentItem}"
                                            value="{fieldRepeater.currentItem}"/>
                 </mx:Repeater>


          </mx:Form>

          <mx:Form label="Child Information" hideEffect="{hideEffect}" showEffect="{showEffect}">
                <mx:FormItem>
                      <mx:DataGrid id="childinfo">
                            <mx:columns>
                                  <mx:DataGridColumn headerText="Child Name" dataField="strName"/>
                                  <mx:DataGridColumn headerText="School Name" dataField="strSchoolName"/>
                                  <mx:DataGridColumn headerText="Pick Up Point" dataField="strPickUpPointName"/>
                                  <mx:DataGridColumn headerText="Drop Down Point" dataField="strDropDownPointName"/>
                            </mx:columns>
                      </mx:DataGrid>
                </mx:FormItem>
               <mx:FormItem>
                      <mx:Button label="click here to see bus location"/>
                </mx:FormItem>


          </mx:Form>
          <mx:Form label="Bus Location" hideEffect="{hideEffect}" showEffect="{showEffect}">
         <maps:Map3D xmlns:maps="com.google.maps.*" mapevent_mappreinitialize="onMapPreinitialize(event)" id="buslocation"  
         width="100%" height="100%" url="http://code.google.com/apis/maps/" key="ABQIAAAAXuX6aG-r_N0-tQNxUEV-vRSE8al1BQssMxLXJiP75kIjR3ssLxT3D52_u94hI-dMIkD72FmnK-P4og"/> 





         </mx:Form>
          <mx:Form label="Bus path" hideEffect="{hideEffect}" showEffect="{showEffect}">
          <maps:Map3D xmlns:maps="com.google.maps.*" mapevent_mappreinitialize="onMapPreinitialize(event)" id="buspath"  
         width="100%" height="100%" url="http://code.google.com/apis/maps/" key="ABQIAAAAXuX6aG-r_N0-tQNxUEV-vRSE8al1BQssMxLXJiP75kIjR3ssLxT3D52_u94hI-dMIkD72FmnK-P4og"/> 




         </mx:Form>
    </mx:TabNavigator>

</mx:Panel>

I am getting this error :-

TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.google.maps.geom::Geometry$/computeSeparatingAxes() at com.google.maps.geom::TileEnumerator/enumerateTiles() at com.google.maps.core::PerspectiveTilePane/computeOptimalSet() at com.google.maps.core::PerspectiveTilePane/render() at com.google.maps.core::PerspectiveTilePane/configure() at com.google.maps.managers::PerspectiveTileManager/updateView() at com.google.maps.managers::PerspectiveTileManager/initializePanes() at com.google.maps.managers::PerspectiveTileManager/onInitialize() at MethodInfo-190() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at com.google.maps.wrappers::BaseEventDispatcher/dispatchEvent() at com.google.maps.wrappers::EventDispatcherWrapper/dispatchEvent() at com.google.maps.core::MapImpl/size() at com.google.maps.core::MapImpl/setSize() at com.google.maps.wrappers::IMapWrapper/setSize() at com.google.maps::Map/internalSetSize() at com.google.maps::Map/onUIComponentResized() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9298] at mx.core::UIComponent/dispatchResizeEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:7077] at mx.core::UIComponent/setActualSize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6706] at mx.containers.utilityClasses::BoxLayout/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\utilityClasses\BoxLayout.as:219] at mx.containers::Form/updateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\containers\Form.as:375] at mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6351] at mx.core::Container/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\Container.as:2677] at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622] at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628] at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

Please resolve my issue.

© Stack Overflow or respective owner

Related posts about flex3

Related posts about actionscript-3