3 Replies Latest reply on Nov 30, 2010 6:55 AM by harry_lai84

    TypeError: Error #1009: Cannot access a property

    harry_lai84 Level 1

      I am running into the following error message

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at mx.managers::PopUpManagerImpl/http://www.adobe.com/2006/flex/mx/internal::createModalWindow()
      at mx.managers::PopUpManagerImpl/addPopUp()
      at mx.managers::PopUpManager$/addPopUp()
      at mx.controls::Alert$/show()
      at MethodInfo-564()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()

       

      It looks to me the alert popup was blocked when the following fuction is being called; but the data still got added to the database. Any thoughts? Thanks for helping.

       

          public function saveData():void
          {
            //var name:String = textInputName.text;
            var comments:String = textCommentAdd.text;
            var type:String = comboBoxType.text;
            var lat:Number = marker.getLatLng().lat();
            var lng:Number = marker.getLatLng().lng();
            var urlRequest:URLRequest = new URLRequest("phpCodes/add_data_to_mysql.php");
            urlRequest.data = "type=" + type + "&comments=" + comments + "&lat=" + lat + "&lng=" + lng;
            urlRequest.method = URLRequestMethod.POST;
            var urlLoader:URLLoader = new URLLoader();
         urlLoader.load(urlRequest);
            urlLoader.addEventListener(Event.COMPLETE, function(e:Event):void {
              if (urlLoader.data.length <= 1) {
                Alert.show("Successfully added!");
                marker.closeInfoWindow();
              } else {
                Alert.show("There was an error adding the data :(");
              }
            });