Actionscript TextFormat issue....

t44studio

New Member
Messages
16
Reaction score
0
Points
0
In my gallery, I've been trying to use a simple preloader for the images. All it consists of is a percentage status in text. However, I wanted to change the format of the text and can't seem to do it right. :mad: I'm not sure if it's the placement or what. Can anyone help with this? I'm using AS2, and below is the code with the problem.

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

var myformat:TextFormat = new TextFormat();

myformat.font = "Arial";
myformat.size = 24;
myformat.bold = true;
myformat.align = "center";
my_text.setTextFormat(myformat);

};
 

VPmase

New Member
Messages
914
Reaction score
1
Points
0
Try adding "_root." infront of "my_text". Sometimes AS thinks you want a var instead of an object. And make sure that you gave the object the instance name "my_text".
 
Last edited:

t44studio

New Member
Messages
16
Reaction score
0
Points
0
I tried adding _root and double-checked the instance name, but it doesn't seem to be making a difference....? Below is the full function; maybe that'll be more helpful?

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);
};
 
Top