-
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.
#
-
Information Architect
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:
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 put some text into the textfield:
Code:
i=10
while(--i){
mytext.text+="another line of text\n";
}
Then if you change the width of text textfield using:
The text will wrap accordingly.
-
Information Architect
-
[Devil in DarkGreen]
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;
DS
-
Information Architect
@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]
-
[Devil in DarkGreen]
sure,you can get them from seletion object
selection.getbeginindex();
selection.getendindex();
DS
-
Information Architect
Thx demons! That makes the project I'm thinking about a lot the last days possible. Thx MM for the new texfield object.
Fredi
-
textfield should has 16 width at least or it cannot work correctly.
and you can control its height-> mytext._height=number;
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.
-
[Devil in DarkGreen]
ok,thx,guy.
-
Flash MX will make this much easier. Just a few more days... :-)
MD
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|