Skip to main content
Participant
February 23, 2007
Question

dynamic text formatting...

  • February 23, 2007
  • 1 reply
  • 151 views
I'm pretty new to ActionScripting, and am trying to change some of the formatting on some code...I've been stumbling through tutorials and putting pieces together roughly. Is there a simply way to change the font and justification of this text? code is as follows:
var nWidth:Number = mcDisplayBackground._width;
var nHeight:Number = mcDisplayBackground._height;
var nX:Number = mcDisplayBackground._x;
var nY:Number = mcDisplayBackground._y;
var nInterval:Number;
this.createTextField("tArticle", this.getNextHighestDepth(), nX, nY, nWidth, nHeight);
tArticle.multiline = true;
tArticle.wordWrap = true;
tArticle.html - true
tArticle.textColor = 0xFFFFFF;
tArticle.htmlText = "Founded in 1989, CYW, Inc. has established itself as the leader in the construction fastener industry.";

mcScrollUp.onPress = function():Void {
nInterval = setInterval(scrollArticle, 50, "up");
};
mcScrollUp.onRelease = function():Void {
clearInterval(nInterval);
};
mcScrollDown.onPress = function():Void {
nInterval = setInterval(scrollArticle, 50, "down");
};
mcScrollDown.onRelease = function():Void {
clearInterval(nInterval);
};
function scrollArticle(sScrollDirection:String):Void {
if(sScrollDirection == "up") {
tArticle.scroll--;
}
else {
tArticle.scroll++;
}
updateAfterEvent();
}

Thanks!
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 24, 2007
there's no simple way to change the font. you can change the font, but to do that you must add a font to your library that has a linkage id, define a textformat object that has its font property assigned to that linkage id, enable the embedFonts property of your textfield and finally you must assign the textformat object to your textfield (using setTextFormat() or setNewTextFormat() ).