Making use of one external text document

I have a flash document that has two text boxes labeled ‘output1’ and ‘output2’. I am trying to make use of one external text document labeled ‘items.txt’ that has two variables located inside the document ‘item1=content1’ and ‘items2=content2’. Using code I found on a Kirupa tutorial, I was hoping that I would only need to use one text document with multiple variables to output my text successfully.

Unfortunately it didn’t come out as I expected: the ‘output1’ textfield outputs the ‘item1’ content properly but also prints out “item2=hi!” directly after it. The ‘output2’ textfield outputs an “undefined” message.

Any help or pointers to resources would be great. Thanks.

(I’m also trying to apply a stylesheet as well, which successfully is applied to the ‘output1’ textfield.)

// Code begin
var format = new TextField.StyleSheet();
var path = “flash.css”;

format.load(path);
format.onLoad = function(loaded) {
if (loaded) {
output1.styleSheet = format;
output2.styleSheet = format;

     myLoadVar  = new  LoadVars  ();
     myLoadVar.load("items.txt")
     myLoadVar.onLoad = function (success){
         if (success == true) {
             output1.variable = "item1"
             output1.htmlText=myLoadVar.item1;
             output2.variable = "item2"
             output2.htmlText=myLoadVar.item2;
         }
 } 

 } else {
     output.text = "Error loading CSS file!";
 }

};

// Code end