3 Replies Latest reply on May 18, 2007 2:11 AM by shasanji

    Load Text file into Textarea

    shasanji
      Hi how can i load text file into Textarea i use this method seems like it load text file but i can't show it in a textarea some one pls help
        • 1. Re: Load Text file into Textarea
          Level 7
          textarea has properties and methods which allow you to give source of text
          to it.
          var loadtext:LoadVars=new LoadVars();
          loadedtext.load("file.txt");
          textarea.text=loadedtext;

          "shasanji" <webforumsuser@macromedia.com> wrote in message
          news:f2hh5v$o5e$1@forums.macromedia.com...
          > Hi how can i load text file into Textarea i use this method seems like it
          > load text file but i can't show it in a textarea some one pls help


          • 2. Re: Load Text file into Textarea
            shasanji Level 1
            hi
            sorry it seems like this 'LoadVars' type does not exists there is an error

            error message is like type was not found or was not compile time constant loadvars error code 1046
            and
            call possibly undefined method loadvars error code 1180
            pls help me

            thanks
            • 3. Re: Load Text file into Textarea
              shasanji Level 1
              hi all
              at last i found the way to load text file in to the textArea it's like

              <mx:Script>
              <![CDATA[
              private function loadText():void {
              var l:URLLoader = new URLLoader(new URLRequest('2.txt'))
              l.addEventListener(Event.COMPLETE, finishLoading);

              }
              public function finishLoading(evt:Event):void {
              var myData:String =new String(evt.target.data)
              txtBox.text=myData;
              }

              ]]>
              </mx:Script>


              this should works because it's work with me
              enjoy the code
              Sanji