External text and variables

Having trouble trying to re-use a page layout mulitple times in one site, but importing different parts of an external text file for each use. The site has various different page layout designs, which can easily be swapped around and still display the correct content (thats the idea anyway)

I’m using this code to import the text:


loadVarsText = new LoadVars();
loadVarsText.load("mainText.txt");
loadVarsText.onLoad = function(success) {
    if (success) {
        scroller2.htmlText = this.page1Title;
    } else {
        trace("not loaded");
    }
};

This works fine, but I need to change ‘page1Title’ variable with ‘currentTitle’ so that the text it imports into the text field from mainText.txt is different depending on which page is currently using the page layout. But when i change it to this:


_root.currentTitle = (_root.pageChoice + "Title");
loadVarsText = new LoadVars();
loadVarsText.load("mainText.txt");
loadVarsText.onLoad = function(success) {
    if (success) {
        scroller2.htmlText = this.currentTitle;
    } else {
        trace("not loaded");
    }
};

…the text field displays the name of the variable (“page1Title”) rather than the content of the page1Title in the text file

Any idea what i can do to fix it?