PDA

View Full Version : target.my_txt ... font size?!



kempo
June 11th, 2008, 05:35 PM
Hello! I'm stuck, I don't usually do actionscripting much and I cannot figure out how to change the size of this font


fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",fullImage_mc.getNextHighestDepth,0,400,200,20);
target.my_txt.selectable = false;
target.my_txt.textColor = "0xFFFFFF";

};

i wanted to do something like how I change the color...just target.my_txt.textSize = But nothing seems to work, any ideas?! Thanks for any help!

James

glosrfc
June 11th, 2008, 10:11 PM
fullPreloader.onLoadStart = function(target) {
target.createTextField("my_txt",fullImage_mc.getNextHighestDepth,0,400,200,20);
target.my_txt.selectable = false;
target.my_txt.textColor = "0xFFFFFF";
// apply new format to textfield if changing existing text
myformat.size = 20;
target.my_txt.setTextFormat(myformat);
// alternatively use
// target.my_txt.setNewTextFormat(myformat);
// to change text added to textfield
};

congyaan
June 12th, 2008, 06:06 AM
What a pity that i see this thread so late,I wasted a lot of time on setTextFormat and setNewTextFormat,because I made the wrong order.

glosrfc
June 12th, 2008, 04:26 PM
Yes, it's easily done.

setTextFormat changes text that already exists in a textfield. Any new text will revert back to the original format.

setNewTextFormat doesn't change text that is already in a texfield. But any new text will reflect the new formatting.

gibry21
June 17th, 2008, 07:04 PM
Hi guys,

Just a quickie, following on from the previous text format question, I to am a novice with this stuff....

I managed to use the above script and get my color changed.....but ur suggestion for size doesnt seem to work...

Works fine - target.my_txt.text = myTitle;
Works fine - target.my_txt.textColor = "0xFFFFFF";


No effect on text -myformat.size = 20;
No effect on text -target.my_txt.setNewTextFormat(myformat);

Any suggestions? Also tried the othe way you suggested. And while I'm here, do you use the same technique to change font style?

Thanks.

My Code: Sorry its messy and has comments:

fullPreloader.onLoadComplete = function(target) {
//new Tween(target, "_alpha", Strong.easeOut, 0, 100, .5, true);
//var myTextTween = new Tween(target.my_txt, "_y", Strong.easeOut, myText_y, -20, 0.5, true);
//target.my_txt.text = myTitle;
//- Start of Glow
if (!myFil) {
_global.myFil = true;
var myGlow = new flash.filters.DropShadowFilter();
myGlow.color = 0xffffff;
myGlow.alpha = 0.4;
var myTempFilters = fullImage_mc.filters;
myTempFilters.push(myGlow);
fullImage_mc.filters = myTempFilters;
}
//- End of Glow
var myFadeIn = new Tween(target, "_alpha", Strong.easeOut, 0, 100, 0.5, true);

var myText_y = target.my_txt._y;

target.my_txt.text = myTitle;
target.my_txt.textColor = "0xFFFFFF";
myformat.size = 20;
target.my_txt.setNewTextFormat(myformat);



//target.my_txt.embedFonts = false;
//target.my_txt.setTextFormat(_root.my_fmt);
var myTextTween = new Tween(target.my_txt, "_y", Strong.easeOut, myText_y, -20, 0.5, true);
};