as2 thumbnail scroller: createTextField issues

Hello, I’m working on a script to make a thumbnail scroller-type gallery powered by XML, the thumbnails scroll and I can get it to have one textField be populated & scroll (by manually put in a text field, and using as2 to have it stay near the thumbnail)

But I’ld like to dynamically load the text and have it stay under each thumbnail as it scrolls.

My textField’s variable name is rText … there’s a box movieclip in the library, which only contains a white square (it gets overwritten with the images etc.)

I really need some help with this because it’s making me crazy…

if I trace container.rText.text I get the text that’s supposed to show up on screen but it never does show up on the screen. any help would be greatly appreciated.

I’ve attached a zip with all the necessary files. please help

thank you…

[edit] This code is fully functional as a thumbnail slider with links, configurable by XML, I’m just having an issue with it not wanting to display AS-created textFields.
[/edit]

The code is:


xmlfile = "photographs.xml";
// load the xml and goto startSlideShow() after
var images_xml:XML = new XML();
images_xml.onLoad = startSlideShow;
images_xml.load(xmlfile);
images_xml.ignoreWhite = true;

//text settings
my_fmt = new TextFormat();
my_fmt.align = 'center';

// some global settings
var settings:Object;
var images:Array;
var images_count:Number;
var images_needed:Number;

var images_active:Array = new Array();
var images_letzteNr:Number;
var images_ersteNr:Number = 0;

var max_r:Number;
var min_l:Number;
var go:Boolean = true;
var dir:String;

// the speed according to the mouse-x-position
var pos_speed:Number = -0.1;

// the depth of the objects
var d = 1;

// this is the invisible square inside which the images are placed
// (default value 140, can be set in the xml)
var a = 142.5;
var autoscroll = false;
// der Interval
var bewegeInterval;

function goStop() {
    if(go){
        ascroll();
    }else{
        pos_speed=0
    }
};

function startSlideShow(success) {

    if (success == true) {
        var p:XMLNode = images_xml.firstChild;
        settings = p.firstChild.attributes;
        images = p.lastChild.childNodes;
        images_count = images.length;

        if (settings.bgColor != null) {
            bc = new Color(bg);
            bc.setRGB(settings.bgColor);
        } else {
            bc = new Color(bg);
            bc.setRGB(0xFFFFFF);
        }
        autoscroll = Boolean(settings.autoscroll);
        dir = settings.dir;
        if (autoscroll == true) {
            ascroll();
        }
        var x = 0;
        var i = 0;

        // we need at least one image
        var sw = Math.max(a, Stage.height);

        while (x<sw) {
            // draw the image
            var imageNumber = i%images_count;

            // load the image and register
            images_active.push(createImage(imageNumber, i*a, img.alt));

            // finally cache the current image number
            images_letzteNr = imageNumber;

            i++;
            x += a;
            max_r = x;
            min_l = 0;
        }

        // store the number of images
        images_needed = i;
    }
    // interval                
    bewegeInterval = setInterval(slide, Number(settings.delay), Number(settings.step));
}
//scount =0;
function slide(stp:Number) {
    //trace(_root.rText._y + " " + _root.holder._y);
    // moves all images
    stp = Math.round(stp*pos_speed);

    min_l += stp;
    max_r += stp;

    //trace("x-bounds: " + min_l + " - " + max_r);
    //trace("nr-bounds 0: " + images_ersteNr + " - " + images_letzteNr);


    var len = images_active.length;

    var new_images_active = new Array();

    for (var k = 0; k<len; k++) {

        var b:MovieClip = images_active[k];
        b._y += stp;
        //trace(b + ": x=" + b._y + ", max_r=" + max_r);

        if (b._y<=-a) {
            //trace("unload bottom");
            b.unloadMovie();
            min_l += a;
            images_ersteNr = (images_ersteNr+1)%images_count;
        } else if (b._y>Stage.height) {
            //trace("unload top");
            b.unloadMovie();
            max_r -= a;
            images_letzteNr = (((images_letzteNr-1)%images_count)+images_count)%images_count;
        } else {
            // behalten
            new_images_active.push(b);
        }

        if (max_r<Stage.height) {
            //trace("create bottom");
            imageNumber = (images_letzteNr+1)%images_count;
            new_images_active.push(createImage(imageNumber, max_r));
            images_letzteNr = imageNumber;
            max_r += a;
        }
        if (min_l>0) {
            // trace("create top");
            imageNumber = (((images_ersteNr-1)%images_count)+images_count)%images_count;
            new_images_active.unshift(createImage(imageNumber, min_l-a));
            images_ersteNr = imageNumber;
            min_l -= a;
        }
    }

    //trace("nr-bounds 1: " + images_ersteNr + " - " + images_letzteNr);
    images_active = new_images_active;

    // update...
    updateAfterEvent();
}
//count = 0;
function createImage(imageNumber:Number, x:Number):MovieClip {
    //trace("create = " + count++);
    var pictureObj = images[imageNumber].attributes;

    var pictureWidf = Number(pictureObj.width);
    var pictureHite = Number(pictureObj.height);

    var pictureX = Math.round(a-pictureWidf)/2 - 2;
    var pictureY = Math.round(a-pictureHite)/2;
    //trace(pictureWidf + " :: " + pictureHite + " // " + a);


    
    var container = _root.createEmptyMovieClip("picture"+d, d);
    container._y = x;
    



    // depth for the next movieclip
    d++;

    // we put two images inside that container: one for the border and the image itself
    var framework:MovieClip = container.attachMovie("box", "framework", 1);
    _root.holder2 = framework._parent;

    

    

    var c = new Color(framework);
    c.setRGB(settings.bordercolor);


            framework._width = pictureWidf+2;
            framework._height = pictureHite+2;
            framework._x = pictureX-1;
            framework._y = pictureY-1;
            

    // the event handler is set to the border
    if (pictureObj.big_src != undefined) {
        var pictureBig = container.createEmptyMovieClip("pictureBig", 3);
        loadMovie(pictureObj.big_src, pictureBig);
        pictureBig._x = pictureX/2;
        pictureBig._y = pictureY/2;
        _root.holder2.pictureBig._alpha = 0;
        //on click make popup of img file.
        framework.onRelease = function() {
            var link:String = pictureObj.link;
            var trgt:String = pictureObj.trgt;
            getURL(link, trgt);
            go = true;
            goStop()
        };
        //framework = border, picture = image.
        framework.onRollOver = function() {
            picture._alpha = 0;
            pictureBig._alpha = 100;
            framework._width = pictureBig._width+2;
            framework._height = pictureBig._height+2;
            framework._y = pictureBig._y-1;
            framework._x = pictureBig._x-1;
            /* ################################################################################## 
            Test rText 
            ####################################################################################*/
            trace(container.rText.text);// = pictureObj.alt;
            _root.holder = this._parent;
            //trace(this._parent);
            go = false;
            goStop()
        };
        framework.onRollOut = function() {
            framework._width = pictureWidf+2;
            framework._height = pictureHite+2;
            framework._x = pictureX-1;
            framework._y = pictureY-1;
            picture._alpha = 100;
            pictureBig._alpha = 0;
            go = true;
            goStop()
        };
        framework.onReleaseOutside = function() {
            var link:String = pictureObj.link;
            var trgt:String = pictureObj.trgt;
            getURL(link, trgt);
            framework._width = pictureWidf+2;
            framework._height = pictureHite+2;
            framework._x = pictureX-1;
            framework._y = pictureY-1;
            picture._alpha = 100;
            pictureBig._alpha = 0;
            go = true;
            goStop()
        };
    } else {
        framework.onRelease = function() {
            var link:String = pictureObj.link;
            var trgt:String = pictureObj.trgt;
            getURL(link, trgt);
            picture._alpha = 100;
            pictureBig._alpha = 0;
        };
        //framework = border, picture = image.
        framework.onRollOver = function() {
            _root.holder = this._parent;
            go = false;
            goStop()
        };
        framework.onRollOut = function() {
            go = true;
            goStop()
        };
        framework.onReleaseOutside = function() {
            var link:String = pictureObj.link;
            var trgt:String = pictureObj.trgt;
            getURL(link, trgt);
            goStop()
        };
    }
    var picture = container.createEmptyMovieClip("picture", 2);
    loadMovie(pictureObj.src, picture);
    
    
    
var rText:TextField = container.createTextField("rText", d, 0, 0, stage.width,25);
    if (_root.settings.txtColor != null) {
            container.rText.textColor = _root.settings.txtColor;
        } else {
            container.rText.textColor = 0x000000;
        }
    container.rText.text = pictureObj.alt;
        trace(container.rText.text);
    container.rText.setTextFormat(_root.my_fmt)

    picture._x = pictureX;
    picture._y = pictureY;


    return container;
}

this.onMouseMove = goStop();
function ascroll() {
    if(go){
        if (dir == "L" || dir == "l") {
            pos_speed = -Math.round(10*((2*200)-Stage.height)/Stage.height)/10;
        } else {
            pos_speed = -Math.round(10*((2*700)-Stage.height)/Stage.height)/10;
        }
    }
}
stop();