Is there any way to dynamically set the "character width" of a text field? I don't want the text to stretch - I want the text to wrap according to the width of the field, as text would in a text editor when you resize the window.
Any guesses?
Printable View
Is there any way to dynamically set the "character width" of a text field? I don't want the text to stretch - I want the text to wrap according to the width of the field, as text would in a text editor when you resize the window.
Any guesses?
Using a whole bunch of actionscript, you can do that now in Flash 5.
Have a look at this tutorial:
http://www.actionscripts.org/tutoria...on/index.shtml
But maybe it'll be a little easier in flash MX.
#
There are much more functionality to textfields. You can create a WYSIWYG editor when I intepreted one Flashguru post lately right. (Can't find it right now, maybe on were-here)
Fredi
If you do this:
Then if you put some text into the textfield:Code://create a new textfield with wordwrap
//this.createTextField("instance_name",1depth,x,y,width,height)
this.createTextField("mytext",1,0,0,200,100)
mytext.wordWrap=true
Then if you change the width of text textfield using:Code:i=10
while(--i){
mytext.text+="another line of text\n";
}
The text will wrap accordingly.Code:mytext._width=10
Thx Guy!
Fredi
hi,guru
thx your coding,and i want add some talk:
textfield should has 16 width at least or it cannot work correctly.
and you can control its height-> mytext._height=number;
D:)S
@guy or demons: Is there a way to check where the cursor and the selected areas (in the textfield) is? That would make a lot more possible.
Fredi
[Edited by Subway on 03-10-2002 at 12:37 PM]
sure,you can get them from seletion object
selection.getbeginindex();
selection.getendindex();
D:)S
Thx demons! That makes the project I'm thinking about a lot the last days possible. Thx MM for the new texfield object.
Fredi
Depends on the font, if you use the |(pipe) symbol and other such like, then the textfield can be two pixels wide if you want it to be.Quote:
textfield should has 16 width at least or it cannot work correctly.
and you can control its height-> mytext._height=number;
:)ok,thx,guy.
Flash MX will make this much easier. Just a few more days... :-)
MD