all groups > flash actionscript > march 2006 >
You're in the

flash actionscript

group:

dynamic text single line


dynamic text single line cadflash2
3/14/2006 10:32:08 PM
flash actionscript: I have a dynamic text inside a rectangle. I need to adjust the font size of the
dynamic text so that it'll fit into the rectangle. I also want to adjust the
text font size when the movie clip is scaled. I'm attaching here with the
sample. It'll be great if you can tell me to adjust font size according to the
scale.
var box_mc = this.createEmptyMovieClip("box", this.getNextHighestDepth());
box_mc.beginFill(0x00aaFF, 100);
box_mc.lineStyle(4, 0xFF0000, 100);
box_mc.moveTo(0, 0);
box_mc.lineTo(0, 100);
box_mc.lineTo(100, 100);
box_mc.lineTo(100, 0);
box_mc.lineTo(0, 0);
box_mc.endFill();
box_mc.createTextField("my_txt", this.getNextHighestDepth(), 2, 50, 100,20);
box_mc.my_txt.text = "Testing Width of the text";
box_mc.my_txt.border=true;
box_mc.onRollOver = function()
{
this._xscale = 300;
this._yscale = 300;
this._x = coord-this._width/2;
this._y = coord-this._height/2;
};
box_mc.onRollOut = function()
{
this._xscale = 100;
this._yscale = 100;
this._x = coord-this._width/2;
this._y = coord-this._height/2;
};

Re: dynamic text single line cadflash2
3/15/2006 5:40:56 PM
Hi I found some post saying that you can not dynamically change the font size,
instead of that use yscale. Can anyone tell me what's the algorithm to adjust
yscale, based on the width of the rectangle and length of the text?
AddThis Social Bookmark Button