2 Replies Latest reply on Jun 9, 2007 9:43 PM by seattlemike

    lastResult Scope in Private Functions?

    seattlemike
      The code for my app is below. I can access the data in lastResult fine if I do the HTTPService.send() ourside of my private function and also access lastResult outside of my private function, however if I put the HTTPService.send() call inside my private function I get "cannot access property of null object" error and traces show lastResult is null. Any idea on what's happening? My ASP page DOES return data so the null isn't a result of no data being returned. Thanks.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Model id="paramModel">
      <root>
      <offeringName>Math 101</offeringName>
      </root>
      </mx:Model>

      <mx:Script>
      <![CDATA[

      private function render():void{
      myHTTPData.send(paramModel);
      debug.text = myHTTPData.lastResult.offeringName[0];
      }
      ]]>
      </mx:Script>

      <mx:HTTPService id="myHTTPData" method="GET"
      url=" http://myServer/myASPPage.asp" //contains actual valid URL in my version
      resultFormat="e4x">
      </mx:HTTPService>

      <mx:Form width="819">
      <mx:Button x="178" y="10" label="Button" click="render();"/>
      <mx:TextInput id="offeringName" x="10" y="10"/>
      </mx:Form>
      <mx:TextArea x="10" y="223" id="debug" width="712" height="159" fontFamily="Courier New" fontSize="10" color="#4a29b4" fontWeight="bold"/>

      </mx:Application>