7 Replies Latest reply on Sep 10, 2007 4:32 PM by kglad

    Newby needs help with external text and actionscript madness.

    scoots101
      Hi,

      Trying to load an external plain txt file into a text field using Actionscript 3.0. The text file is saved in UTF-8 format in the same file as the Flash movie and I'm using the following code:

      var external_txt:TextField = new TextField();
      var externalReq:URLRequest = new URLRequest("external.txt");
      var externalLoad:URLLoader = new URLLoader();

      externalLoad.load(externalReq);

      externalLoad.addEventListener(Event.COMPLETE, textReady);

      external_txt.x = 175;
      external_txt.y = 100;
      external_txt.border = true;
      external_txt.width = 200;
      external_txt.height = 200;
      external_txt.wordWrap = true;

      addChild(external_txt);

      function textReady(event:Event):void
      {
      external_txt.text = event.target.data;
      }

      When I test the movie, the following error message appears in the output window:

      Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///F|/FlashCS3/FlaFiles/external.txt
      at ScrollingTextField_fla::MainTimeline/ScrollingTextField_fla::frame1()

      I know the solution's probably extremely simple, but I'm new to Actionscript and can't get round it. Anybody have any suggestions?

      Scoots