# Create Dynamic Text field problem

**URL:** <https://forum.kirupa.com/t/create-dynamic-text-field-problem/276033>\
**Category:** flash\
**Created:** [November 21, 2008, 3:28pm UTC](https://forum.kirupa.com/t/create-dynamic-text-field-problem/276033 "2008-11-21T15:28:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poncho5k](https://avatars.discourse-cdn.com/v4/letter/p/f9ae1b/32.png) [@Poncho5k](https://forum.kirupa.com/u/Poncho5k)\
**Post date:** [November 21, 2008, 3:28pm UTC](https://forum.kirupa.com/t/create-dynamic-text-field-problem/276033/1 "2008-11-21T15:28:00Z")

</div>

function buildImageBox() {  
imageText = \_root.Images[\_root.p].attributes.title;

```
imageURL = _root.Images[_root.p].firstChild.nodeValue;
imageURL = "images/"+imageURL;
trace(imageURL);
thisClip = createEmptyMovieClip("image"+_root.p, this.getNextHighestDepth());

thisClip._y = (_root.p*150+40);
thisClip._x = 20;

var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();

listener.onLoadInit = function(target:MovieClip):Void {
    trace(target+".onLoadInit");
    var thisTextClip:MovieClip = target;
    target.oWidth = target._width;
    target.oHeight = target._height;
    trace("Width: "+target._width);
    trace("Height: "+target._height);

    if (target._width&gt;target._height) {
        intScale = 100/target._height;
        intDupScale = 212/target._height;
        target._yscale = intScale*100;
        target._xscale = intScale*100;
        trace(target._xscale);
    } else {
        intScale = 100/target._width;
        intDupScale = 212/target._width;
        target._yscale = intScale*100;
        target._xscale = intScale*100;
        trace(target._xscale);
    }

```

// textY.\_y = (target.\_y + target.\_height + 15);  
// textX.\_x = target.\_x;  
thisTextClip.createTextField(“test\_txt”+\_root.p, \_root.scrollHolder.box1.getNextHighestDepth(), 0, 0, 100, 100);  
thisTextClip[“test\_txt”+\_root.p].\_y = target.\_y + target.\_height + 10;  
thisTextClip[“test\_txt”+\_root.p].\_x = target.\_x;

```
    thisTextClip["test_txt"+_root.p].text = imageText;
    thisTextClip["test_txt"+_root.p].wordWrap = true;
    thisTextClip["test_txt"+_root.p].size = 12;
    thisTextClip["test_txt"+_root.p].textColor = 0x00cc00;
    thisTextClip["test_txt"+_root.p].bold = false;
    thisTextClip["test_txt"+_root.p].embedFonts = true; 
    thisTextClip["test_txt"+_root.p].autoSize = true; 
    var emphatic:TextFormat = new TextFormat();
    emphatic.bold = true;
    emphatic.size = 16;
    emphatic.font = "Georgia";
    thisTextClip["test_txt"+_root.p].setTextFormat(emphatic);

    trace("THIS IS THE TEXT " + thisTextClip["test_txt"+_root.p].text);
    trace(thisTextClip["test_txt"+_root.p]._y + " SHOW IT TO US")
    target.myName = "image"+_root.p;
    target.intScale = intDupScale;
    target.onRelease = function() {
        duplicateImage(this.myName,this.intScale,this.oHeight,this.oWidth);
    };
    if (_root.p&lt;_root.Images.length-1) {
        _root.p += 1;
        buildImageBox();
    }

};
mcLoader.addListener(listener);
mcLoader.loadClip(imageURL,thisClip);

```

}

function duplicateImage(grabThisClip, intScale, thisHeight, thisWidth) {  
trace(grabThisClip);  
// new Bitmap  
// draw.  
trace(thisWidth+" | "+thisHeight);  
bmap = new flash.display.BitmapData(thisWidth, thisHeight, false, 0);  
//var m:Matrix = new Matrix();  
[//m.scale](https://m.scale)(1,1);  
[//bmap.draw](https://bmap.draw)(grabThisClip,m);  
bmap.draw(grabThisClip);

```
_root.addPhoto1.holder.attachBitmap(bmap,0);
_root.addPhoto1.holder._xscale = intScale*100;
_root.addPhoto1.holder._yscale = intScale*100;
_root.addPhoto1.holder._x = 0;
_root.addPhoto1.holder._y = 0;
_root.addPhoto1.holder.onPress = function() {
    if (thisHeight&lt;thisWidth) {
        _root.addPhoto1.holder.startDrag(false,0,0,-_root.addPhoto1.holder._width+212,0);
    } else {
        _root.addPhoto1.holder.startDrag(false,0,0,0,-_root.addPhoto1.holder._height+212);
    }
};
_root.addPhoto1.holder.onRelease = function() {
    _root.addPhoto1.holder.stopDrag();
};

```

}

var myImages:String = “image”;

/\*clipsUp.onRelease = function() {

```
for (i=0; i&lt;=_root.p; i++) {
    if (eval(myImages+_root.p)._y &gt;= 0) {
        eval(myImages+i)._y -= 50;
        trace("running");
    }
}

```

};

clipsDown.onRelease = function() {

```
for (i=0; i&lt;=_root.p; i++) {
    if (eval(myImages+1)._y &lt;= 40) {
        eval(myImages+i)._y += 50;
        trace("running");
    }
}

```

};\*/

so yea this is my code. does anyone know why mytext field wouldn’t be showing up? Thanks.
