Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Number Of Lines In A Textfield



Hi all

Seem to have gone a bit dumb tonight. Anyone know how to get the number of lines in a textfield?

Cheers

Dan



Ultrashock Forums > Flash > ActionScript
Posted on: 2003-11-06


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How To Find Number Of Lines Of Dynamic Text...and How Many Lines In Textfield
is there any way of finding out how many characters will fit in a dynamic textfield?

I have a textfield that is dynamically loaded with text. Sometimes the text is long and i need scroll buttons, but when the text is short i would like not display the scroll buttons.

How can i figure out if text is short enough not to display the scroll buttons?

oh..to make it even more complicated; the font of the text is not always the same. I use textformatting to display header-like lines in the textfield.

TextField - Number Of Lines, Number Of Characters
Hello,

I'm trying to get some insight on the textField object in flash.

I know how to get the textfield length and number of characters. But I need to know more.

Is there a way to get the number of characters on a line in a multiline textfield?

Thank you in advance.

Get Number Of Lines In Dynamic Textfield
Hi there guys,

I made a textfield which loads it's content from a textfile, this text can vary in length. Below this textfield I'd like to display a button in a movieclip that always has the same distance from the bottomline of the text.

Can I detect over how many lines the text is wrapped in a dynamic textfield?

Greets

Count Number Of Lines In Textfield?
Is it possible to count the number of lines in a textfield? This because I want to change the border I made around the textfield and give it the same height (1 line -> graphic of 20px, 2 lines, graphic of 40px )

Limit Number Of Lines In A Textfield
Hi there!

i need to limit the number of lines in a text field... Can any one help?

I know how to limit the number of characters, but that's no good. I need to limit the text field so that it prints in 2 pages. First I just counted the number of chars, but someone could insert several returns, the max number of chars would not be reached but it would still not fit in the printed page.

Thanx!!

Textfield Number Of Visible Lines
Hey all,

short question: is there a way to easily find the number of visible lines in a multiline Textfield?

Thanks for any help!
Jay

TextField Maximum Number Of Lines
My AS class is creating dynamic TextFields that word-wrap with multiline. Some of the text that goes in these TextFields is rather long, so I'd like to limit the maximum number of lines that the TextField can have. Is there an easy way to do this?

Best Way To Count The Number Of Lines In A TextField
I have a TextField being created and populated at runtime. How can I go about getting the number of lines of text it contains? I have wrapping turned off if that helps.

Total Number Of Lines In Textfield?
Hi there,
Is there a way to get the total number of lines from a textfield? (including the ones that are not visible and need to be scrolled)

Detect Number Of Lines In Dynamic Textfield
I've been trying to detect the number of lines used in a dynamic textfield without any luck. I have tried using the scroll property of a field which didn't work (Find my attempt attached) Does anyone have any suggestions?

Thanks.

Detect Number Of Lines In Dynamic Textfield
I've been trying to detect the number of lines used in a dynamic textfield without any luck. I have tried using the scroll property of a field which didn't work (Find my attempt attached) Does anyone have any suggestions?

Thanks.

Determining The Number Of Lines Of Text In A Dynamic Textfield?
Hi folks,

Is it possible to determine the number of lines in a dynamic textfield?

I'm importing xml on the fly and want to be able to determine the size of the textfield or number of lines of text imported. If Flash can determine .scroll and .maxscroll then it must know the number of lines of text. How do I access this?

Any ideas?
Thanking you

DM

Dynamicaly Setting Number Of Lines / Height Of A Textfield?
Hi,

is there a way to dynamicaly set the number of lines in a textbox. I've made a scrolling function that scrolls the clip the text is in and not the textbox itself. Thsi way the scrolling is much smoother. Now ofcourse, I have to set the number of lines (or height) of the textbox dynamicaly.

Is there a way tro do this?

cYa

Ivo

Determine Number Of Lines In A Textfield Before 'maxscroll' Has Changed ?
Hi there,

I'm trying to determine the number of lines of text in the (dynamic)textfield before the 'maxscroll' value has changed or the textfield is full.
Normaly you would determine the lines of text by adding up the 'maxscroll' value with the number of ('possible') lines in the textfield, right?
But how to determine the number of lines any time? Character width is variable so... Any suggestions?

ThanX, cYa.

Number Of Lines
Hi
is it posible to get the number of lines from a dynamic or input text field?

thank's

Che

Working Out Number Of Lines
Hi,

I am trying to work out number of lines of text various HTML text takes as I need to position the screen accordingly.

So I have a plain html textbox postioned of screen one line in size and multiline property also using the same width and the correct font. This box is called text_max.


In the code I assign this box the text I wish to work out


Code:

text_max = eval("question_"+text_count);
text_max.scroll = "999999";
var line_count = text_max.scroll;




which works great however when question has some italic tags in it calculates the number of lines incorrectly usually adds 1 but this is not consistent.

Does anyone know a fix????

Counting No. Number Of Lines
Flash MX 2004
Actionscript 2

Hi I've got a dynamic text box. The content may sometimes exceed the size of the text box so it needs to become scrollable when the number of characters or lines exceeds a certain amount. When there is too much content it will send the timeline to a frame which has a scrollable text box. This is because most of the pages will not be scrolling and i dont want a scrollbar when its not required.

So, I was thinking of just counting the number of characters in the dynamic variable and if this was greater than a certain number it would perform a function. But what if the user inputs line breaks? This wont add any more characters but will affect the number of lines. So my question is how do I calculate whether or not my text box has more lines than it can hold?

1 - Do i do this by a character count from the variable? Problem with this is how do i recognise line breaks?
2 - Is there a way to calculate how many lines there are from the variable? If the text box can hold 15 lines for example then if there are more than 16 lines it needs to send the timeline to a different frame. But wouldnt I have to set an average character count for each line. This is never exact is it because some letters are wider than others.
3 - Is there a way to calculate how many lines are being used once the variable has loaded into the text box?

Many thanks

M

Number Of Lines In A Text Box
can you read the amount of lines of text in a dynamic text box when the the amount of lines is less than the hight the of the text box in lines

Limit Number Of Lines
I know how to limit the number of characters that a user can input, but is there a way to limit the number of lines that a user can input into a textbox.

Number Of Text Lines?
Hi,

I'm loading a few bits of text into a dynamic textbox and I want to know if it's possible to find out the number of lines its taking up. Using the height of the textbox isn't an option as the text varies all the time.

Any ideas?

Getting The Number Of Lines In A Textbox With Actionscript
i need to know wether it's possible to get the number of lines in a textbox with actionscript. i am hoping that there is a property similar to .scroll or .maxscroll, that returns a number.

please anybody help me
thanks in advance

-marco treven

Number Of Lines In Dynamic Text
I want to have a dynamic text box that is sized to the length of the text.

Since I know that the font is 12 pixels and by default has 14 pixel line spacing, I can take the number of lines and multiply by 14 to get the height in pixels.

myBox._height = numLines * 14;

What I need to know is how to find out the number of lines that are imported in the dynamic text.

I found out that on average, a full line of text contains 47 characters, BUT not every line is full so I end up not getting the right number of lines when I devide the length of the string by 47.

numLines = length(myString) / 47;

I need a new numLines equation! :P

Thanks!

Number Of Lines In A Text Field
Is there a way to get the number of lines a multi line text field has? It is a dynamic text field, and I need the number of lines of text has been outputted to it. I assumed it would be a property of textfield, but it's not. Thanks.

Count Number Of Lines In A Text Box
Hi, i have a tet boxy dynamically populated from an xml file with html
I need to know how many lines of text there are so that i can make the text box resize to fit all in

Thanks

How To Revers A Number Of Lines From Down2up ?
hi

if i have this text


Code:
this text have
a four line
and i want to
revers it.


i want the text show like this


Code:
revers it.
and i want to
a four line
this text have


thanx

InputText - Way To Limit Number Of Lines
Is there a way to limit the number of lines that a user can type into in a input text field -if multiline is selected then the user can pretty much type for ever - can this be limited to let's say 3 lines. Also can the letting (the space between the lines of text) be changed to tighten up the text that's input.
Thanks.

Counting The Number Of Lines From Txt File
Can you please help me with a problem?
I need to count the number of lines that exists in a txt file, from wich I load some content. I think I need to escape the content of the txt to be able to read the "/n", to count them and to have them displayed as variable (for example t_linenumber=...?)

Maximum Number Of Actionscript Lines
Hey guys.
Does anyone know what the maximum number of lines of actionscript possible in one frame is? Ive got around 1274 and every time I run flash it crashes. When I remove a few lines of script, it works fine. Even if the script in question isnt run at all.

The only possibility i can think of is flash doesnt like lots of lines of script.

help appriciated
~TheWaste

edit: also, could be a maximum number of if statements or something... im not sure

How Do I Extract X Number Of Lines From A Text Box?
I have a text box with text in.

Can someone tell me how I extract X number of lines?
I've been through the help files and can't see how this can be done.

Thanks.


OM

Maximum Number Of Lines Of Code
Hello all,

I've been creating a huge code for something I've been working on and somewhere between 1000 and 10000 (I did a "copy/paste" so I'm not sure of the limit) the code just stopped working (and there's no error on it)

Does actionscript 2.0 has a limit of code lines? Does actionscript 3.0 has it as well?

Tnx in advance
Keish

Number Of Text Field Lines
I am loading some text into a multiline size defined text field. How can I, after I load the text, get the number of lines that the text field has ?

Limit Number Of Lines In An Input Box
This might go in actionscript, but its a question I have about input text boxes. I need to limit the text to 2 lines, not characters.

Thanks in advance
Eric

PS I have looked a little, and used my very tiny bit of actionscript knowlege but I have no idea where to even start.

Counting The Number Of Lines From Txt File
Can you please help me with a problem?
I need to count the number of lines that exists in a txt file, from wich I load some content. I think I need to escape the content of the txt to be able to read the "/n", to count them and to have them displayed as variable (for example t_linenumber=...?)

How Do I Detect The Maximum Number Of Lines
Situation:
I have a textfield that displays about 8 lines of text before the content would need to be scrolled to view the remaining content.

Question
Rather than having some ActionScript that is constantly trying to scroll the field, how do i detect the following.
How do i determine the maximum number of lines that may be displayed in a textField (or any type of text field) before scrolling would be needed?
Please specify the method. Thank you.

Reading Number Of Lines From Txt File
Hello

I have the following problem:

I have an animation that reads some info from a txt file (such a bkg color, bkg image and text). So I would like to make my main animation in the root to repeate a segment of the animation (beteween 50 and 80 frame) or to loop an MC so many times like the number of lines in this txt file.

For exapmle if I have in my txt 6 lines to go from 50 to 80 frames, that again to 50 and like this 6 times (e.g. to repeat this segment 6 times)

Can you help me, please?

Counting The Number Of Lines From Txt File
Can you please help me with a problem?
I need to count the number of lines that exists in a txt file, from wich I load some content. I think I need to escape the content of the txt to be able to read the "/n", to count them and to have them displayed as variable (for example t_linenumber=...?)

How Do I Extract X Number Of Lines From A Text Box?
I have a text box with text in.

Can someone tell me how I extract X number of lines?
I've been through the help files and can't see how this can be done.

Thanks.


OM

Counting The Number Of Lines In A String
I was wondering if there was a way to count the number of lines in a string. Example...


Code:

var blah:String = String("Blah
Blah
Blah!")
I was wondering if there was a tokenizer or a method of counting the
or maybe something like the .length property. Thanks for the help everyone!

Reading Number Of Lines From Txt File
Hello

I have the following problem:

I have an animation that reads some info from a txt file (such a bkg color, bkg image and text). So I would like to make my main animation in the root to repeate a segment of the animation (beteween 50 and 80 frame) or to loop an MC so many times like the number of lines in this txt file.

For exapmle if I have in my txt 6 lines to go from 50 to 80 frames, that again to 50 and like this 6 times (e.g. to repeat this segment 6 times)

Can you help me, please?

Counting The Number Of Lines From Txt File
Can you please help me with a problem?
I need to count the number of lines that exists in a txt file, from wich I load some content. I think I need to escape the content of the txt to be able to read the "/n", to count them and to have them displayed as variable (for example t_linenumber=...?)

Number Of Lines, Loaded From A Txt File
Hello

I have the following problem:

I have an animation that reads some info from a txt file (such a bkg color, bkg image and text). So I would like to make my main animation in the root to repeate a segment of the animation (beteween 50 and 80 frame) or to loop an MC so many times like the number of lines in this txt file.

For exapmle if I have in my txt 6 lines to go from 50 to 80 frames, that again to 50 and like this 6 times (e.g. to repeat this segment 6 times)

Can you help me, please?

How Do I Extract X Number Of Lines From A Text Box
I have a text box with text in.

Can someone tell me how I extract X number of lines?
I've been through the help files and can't see how this can be done.

Thanks.


OM

Counting Number Of Lines In A Text Field
Hi, is there anyway to count the number of lines in a text field?

I know you can count the characters, but a line of x with of 'w's will not contain as many characters as a line of 'i's.

Can you help me?

Cheers,

M@

Count Number Of Lines And Break Up Text?
Hi FK friends

I'm working on a new site. Check this link to see the result so far:
Website

I want to break up the text if it's too long and show the rest of the text after clicking a button. As you can see it's working in the most simple way but as you can see it's not working really well.

I'm counting the amount of characters but that gives 2 problems.
* I've got no control of the height of the text, because on one page the characters are more concentrated then on the other page.
* It breaks up words halfway instead of at the end where a whitespace is.

I know mono fonts give more control, but it's just to ugly to use, ecpecially with this kinda style of site.

This is my script:


Code:
System.useCodepage = true;
textLength = 760;
n = 0;
index = n + 1;

homeText.html = true;
homeText.multiline = true;
homeText.wordWrap = true;
homeText.condenseWhite = true;

myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
tarray = new Array();
for (i=0; i<(this.homeText.length/textLength); i++) {
splitvar = this.homeText.substr((i*textLength), textLength);
tarray.push(splitvar);
}
homeText.htmlText = tarray[n];
} else {
homeText.htmlText = "error loading";
}
};

myData.load("mansanText.html");

btLeesMeer.onRelease = function():Void {
homeText.htmlText = tarray[index++];
}


My question is: Is it possible to count the number of lines instead of the number of characters?

If anyone has suggestions or any tips/help it would be much appreciated!

Thanx in advance

[CS3] Restricting Text Entry To A Certain Number Of Lines
hi everyone!!

I had this problem with my input text field box which I did not want to scroll and wanted to set the number of lines to the height of my text field.

so I found this on the net. It works almost amazing.

txt.onChanged = function(){
var symbol:String = "\r";
var symbolPos:Number = txt.text.indexOf(symbol);
if (symbolPos > -1) {
txt.replaceText(symbolPos, symbolPos + 1, ' ');
} else {
}
for(i=0; i< txt.text.length; i++){
txt.scroll = txt.maxscroll;
if(txt.bottomScroll > 5){
txt.text = txt.text.slice(0, txt.text.length-1);
}
}
}

but when I type "enter" after the 5th line it goes down to the 6th line until I type anything else! it drives me mad as I want it to be perfect...

any suggestions of how I can avoid this "enter" problem?


any help will be appreciated as usual!!!

Limiting Number Of Lines Of Text In A Variable
Hi,

I have a scrolling chat field that I want to keep the last 50 lines of text in. What is the *most efficient* way to strip off the older data? New text is being appended to the end of the scrolling list, so the latest info is at the bottom, and the stuff I want to get rid of is at the top.

Thanks,
-Chilton

Count Number Of Lines In Dynamic Text?
Is there a way to count number of text lines in a dynamic text field?

Detect Number Of Lines Of Text And Then Break?
Hi AS friends,

Anyone know how i can split up dynamicly loaded text according to the number of lines that are allowed? I'v managed to make it work after a week of searching and trial and error, but it's based on the amount of characters, what is not what i want because i've got no control over the actual height of the text since the concentration of characters differ per page.

This is what i mean: The Website

This is the code:


Code:
System.useCodepage = true;
textLength = 760;
n = 0;
index = n + 1;

homeText.html = true;
homeText.multiline = true;
homeText.wordWrap = true;
homeText.condenseWhite = true;

myData = new LoadVars();
myData.onLoad = function(success) {
if (success) {
tarray = new Array();
for (i=0; i<(this.homeText.length/textLength); i++) {
splitvar = this.homeText.substr((i*textLength), textLength);
tarray.push(splitvar);
}
homeText.htmlText = tarray[n];
} else {
homeText.htmlText = "error loading";
}
};

myData.load("mansanText.html");

btLeesMeer.onRelease = function():Void {
homeText.htmlText = tarray[index++];
}
Is it possible to set the number of lines that are allowed and then split the text? I already have been playing with text._height and text.textHeight etc but it's just beyond me. I'm not that advanced in Flash AS yet.

If anyone can help me out here i would be very gratefull!

Thanx in advance.

Xs.

Dynamic Text: Counting The Number Of Lines
is it possible to count the number of lines in a dynamic textfield?


thanks
.dnd

Copyright © 2005-08 www.BigResource.com, All rights reserved