2 Replies Latest reply on Feb 8, 2007 7:33 PM by ggshow

    loading external txt into a movie clip

    superdk
      I'm trying to load an external txt file into a movieclip. My movieclip is10 frames long with tween; with one layer containing a dynamic text box labeled 'loadInfo'. The movieclip is placed on frame 25 of the root time line.

      Here's the code I'm using (frame one of root time line) :

      var myLV:LoadVars = new LoadVars ();

      myLV.onLoad = function (success) {
      if (success) {
      _level0.loadedInfo.htmlText = myLV.info;
      }else{
      level0.loadedInfo.text = "There has been an error loading requested information. Please contact the webmaster and report error.";
      }
      }

      code on frame one in movieclip:

      level0.myLV.load("Events.txt");

      Right now nothing happen, but if I make a dynamic text box on the root time line using the same code it works. Not sure where to go from here..??...
      Thanks for any help,
      Dave
        • 1. Re: loading external txt into a movie clip
          kglad Adobe Community Professional & MVP
          that code is trying to assign htmlText to a textfield that is on the _level0 timeline.

          if you want to target a textfield that's in a movieclip, you need to use the path/instance name to the textfield.
          • 2. Re: loading external txt into a movie clip
            ggshow Level 2
            1st, in your script, line 6, "level0"? it should be "_level0".
            2nd, your html property for loadedInfo textfield has been enabled?

            If you need to use html in your text field, try use this script:

            var myLV:LoadVars = new LoadVars ();
            myLV.onLoad = function (success) {
            _level0.loadedInfo.html = true;
            if (success) {
            _level0.loadedInfo.htmlText = myLV.info;
            }else{
            _level0.loadedInfo.htmlText = "Blah Blah Blah error...";
            }
            }