# TextFormat is driving me crazy!

**URL:** <https://forum.kirupa.com/t/textformat-is-driving-me-crazy/266252>\
**Category:** Uncategorized\
**Created:** [July 17, 2008, 6:22pm UTC](https://forum.kirupa.com/t/textformat-is-driving-me-crazy/266252 "2008-07-17T18:22:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![t44studio](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@t44studio](https://forum.kirupa.com/u/t44studio)\
**Post date:** [July 17, 2008, 6:22pm UTC](https://forum.kirupa.com/t/textformat-is-driving-me-crazy/266252/1 "2008-07-17T18:22:20Z")

</div>

I’m trying to format the text for my preloaders on my page, but I can’t seem to get TextFormat to work. Ⓜ I’ve been searching through forums and tutorials all day but can’t seem to find where I went wrong. If anyone could tell me where I’m being an idiot, it would be highly appreciated! PLEASE help. Here is the code (note there are three preloaders):

stop();

var thumb\_spacingX = 57;  
var thumb\_spacingY = 67;  
var i = 0;  
var rows = 3;  
var cols = 4;  
var g = 0;

var portfolio\_xml = new XML();  
portfolio\_xml.ignoreWhite = true;  
portfolio\_xml.load(“portfolio.xml”);

portfolio\_xml.onLoad = function() {  
\_root.gd1 = portfolio\_xml.firstChild.firstChild.firstChild.childNodes;  
\_root.gd2 = portfolio\_xml.firstChild.firstChild.childNodes[1].childNodes;  
\_root.o1 = portfolio\_xml.firstChild.childNodes[1].firstChild.childNodes;  
\_root.o2 = portfolio\_xml.firstChild.childNodes[1].childNodes[1].childNodes;

```
_root.images = [gd1, gd2, o1, o2];

callThumbs();

```

};

function callThumbs() {  
var clipLoader = new MovieClipLoader();  
var preloader = new Object();  
clipLoader.addListener(preloader);

```
for (var row = 0; row &lt; rows; row++) {
    for (var col = 0; col &lt; cols; col++) {
        var currentPicture = images[g]*.attributes.thumb;
        
        if (currentPicture == undefined) {
            menu_mc.removeMovieClip(i);
        }
        
        currentThumb_mc = menu_mc.createEmptyMovieClip(i, i);
        currentThumb_mc._x = col * thumb_spacingX;
        currentThumb_mc._y = row * thumb_spacingY;
        
        clipLoader.loadClip(currentPicture, currentThumb_mc);
        
        preloader.onLoadStart = function(target) {
            target.createTextField("my_txt", target.getNextHighestDepth, 15, 15, 100, 20);        
        };
        
        preloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
            target.my_txt.text = String(Math.floor((loadedBytes/totalBytes) * 100)) +" %";
            my_text.selectable = false;
            var myformat = new TextFormat();
    
            myformat.font = "Arial";
            myformat.bold = true;
            myformat.align = "center";
            my_text.setTextFormat(myformat);
        };
        
        preloader.onLoadComplete = function(target) {
            new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
            target.my_txt.removeTextField();
            target.onRelease = function() {
                callFullImage(this._name);
            };
            target.onRollOver = function() {
                this._alpha = 50;
            };
            target.onRollOut = function() {
                this._alpha = 100;
            };
        };
        i++;
    }
}

```

};

function callFullImage(myNumber) {  
myURL = images[g][myNumber].attributes.image;  
myType = images[g][myNumber].attributes.theType;  
myClient = images[g][myNumber].attributes.theClient;  
myDescription = images[g][myNumber].attributes.theDescription;  
var fullClipLoader = new MovieClipLoader();  
var fullPreloader = new Object();  
fullClipLoader.addListener(fullPreloader);

```
currentFull_mc = image_mc.createEmptyMovieClip(1, 1);
fullClipLoader.loadClip(myURL, currentFull_mc);

fullPreloader.onLoadStart = function(target) {
    target.createTextField("my_txt", image_mc.getNextHighestDepth, 20, 20, 200, 20);        
};

fullPreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
    target.my_txt.text = String(Math.floor((loadedBytes/totalBytes) * 100)) + " %";

    my_text.selectable = false;
    var myformat = new TextFormat();
    
    myformat.font = "Arial";
    myformat.bold = true;
    myformat.size = 14;
    myformat.align = "center";
    my_text.setTextFormat(myformat);
};

fullPreloader.onLoadComplete = function(target) {
    new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
    target.my_txt.removeTextField();
    type_txt.text = myType;
    client_txt.text = myClient;
    description_txt.text = myDescription;
    target.onRelease = function() {
        callLargeImage(myNumber);
    };
    target.onRollOver = function() {
        this._alpha = 80;
    };
    target.onRollOut = function() {
        this._alpha = 100;
    };
};

```

};

function callLargeImage(myNumber) {  
myURL = images[g][myNumber].attributes.large;  
lheight = images[g][myNumber].attributes.h;  
lwidth = images[g][myNumber].attributes.w;

```
_root.createEmptyMovieClip("largeImage_mc", _root.getNextHighestDepth());

var myDropFilter = new flash.filters.DropShadowFilter(4, 45, 0x000000, 0.7, 10, 10, 2, 10);
var myFilters:Array = largeImage_mc.filters;
myFilters.push(myDropFilter);
largeImage_mc.filters = myFilters;        

var largeClipLoader = new MovieClipLoader();
var largePreloader = new Object();

largePreloader.onLoadInit = function(target) {
    largeImage_mc._x = Stage.width/2 - largeImage_mc._width/2;
    largeImage_mc._y = Stage.height/2 - largeImage_mc._height/2;
}

largeClipLoader.addListener(largePreloader);

largePreloader.onLoadStart = function(target) {
    target.createTextField("my_txt", large_mc.getNextHighestDepth, 360, 240, 200, 20);
    

            
    target.onRelease = function(){
        this.removeMovieClip();
    }
};

largePreloader.onLoadProgress = function(target, loadedBytes, totalBytes) {
    target.my_txt.text = String(Math.floor((loadedBytes/totalBytes) * 100)) + " %";

    my_text.selectable = false;
    var myformat = new TextFormat();
    
    myformat.font = "Arial";
    myformat.size = 24;
    myformat.bold = true;
    myformat.align = "center";        
    my_text.setTextFormat(myformat);

};

largePreloader.onLoadComplete = function(target) {
    new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
    target.my_txt.removeTextField();
};
    
largeClipLoader.loadClip(myURL, largeImage_mc);

```

};
