Re: Fit TextField. I need help or tutorial please

#3
The solution:

I have created a MovieClip that contains the TextFields.
I have created a layer and a keyframe and I have adapted this code.

Code: Select all

import flash.events.Event;
import flash.text.*;

var f0:TextField;

f0.selectable = false;
f0.border = false;
f0.multiline = false;
f0.wordWrap = false;

stage.addEventListener(Event.ENTER_FRAME, scalef0);
 
function scalef0(e):void{
	var wi:int = 1200;
	f0.autoSize = TextFieldAutoSize.LEFT;
	f0.scaleX = 1;
	//f1.text = Input;
	if (wi < f0.width)
	{
		f0.scaleX = wi / f0.width;
	}

}


var f1:TextField;

f1.selectable = false;
f1.border = false;
f1.multiline = false;
f1.wordWrap = false;


stage.addEventListener(Event.ENTER_FRAME, scalef1);
 
function scalef1(e):void{
	var wi:int = 1200;
	f1.autoSize = TextFieldAutoSize.LEFT;
	f1.scaleX = 1;
	//f1.text = Input;
	if (wi < f1.width)
	{
		f1.scaleX = wi / f1.width;
	}
	
}
It works perfectly. I'm not anything easy with the classes.