1 Reply Latest reply on Jul 20, 2008 11:22 PM by SujitG

    Loading Text In Flex 2

    BudHud Level 1
      I am trying to load text from the same folder as the Flex 2 program. There are two questions. If the imports are okay. Then I get the 1061 error message where indicated.

      1061: call to a possibly undefined method addEventListner through a static type mx.rpc.http.HTTPService;

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="loadText(event)">

      <mx:Script>
      <![CDATA[
      import mx.rpc.events.ResultEvent;
      import mx.rpc.http.HTTPService;
      import mx.events.FlexEvent;

      private var textService:HTTPService = new HTTPService();

      private function loadText(e:Event):void{
      textService.url = "Text.txt";
      textService.resultFormat = "text";

      1061 textService.addEventListner(ResultEvent.RESULT,resultHandler);

      textService.send();
      }
      private function resultHandler(e:ResultEvent):void {
      txtLoadedContent.text = e.target.lastResult;
      }
      ]]>
      </mx:Script>



      <mx:VBox x="10" y="10">

      <mx:Text id="txtLoadedContent"/>

      </mx:VBox>

      </mx:Application>

      If you could help, I would really appreciate it.

      JWillen