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








Find Numbers Of Lines In A TextField?


i made this dynamic textfield which loads an external .txt-file, with up/down-button for scrolling/viewing the text.

i want to add a slider instead of the up/down-buttons. the slider is done but the problem i need to find out how many lines the textfield consist of. this is because i use a easy %-formula to calculate how much to scroll up/down according to the slider position.

anyone knows a way to find out the number of lines in a dynamic textfield?




ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 09-19-2006, 12:53 PM


View Complete Forum Thread with Replies

Sponsored Links:

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.

View Replies !    View Related
My 'find' Won't Find Empty Lines And } Now
on 750 buttons I'm trying to go from:
{
Sound01

}

}
}

to:
{Sound01}

by deleting the empty lines and these } using find & replace - and when I hit replace all - it says none found, even though I copy directly from button code...

Is possible this happened by earlier having copied code from AS window - pasting it onto main stage to hold it while busy doing something else - then later double-clicking it and copying it into the find/replace window - which strangely puts little squares in wherever there was a carriage return??? Help please.

View Replies !    View Related
Count Numbers Of Lines?
hi i have an array with several numbers in it something like this
2,3,4,5,2,3,1,3,2,4
The numbers standing for point where a line is drawn to so basicly the line begins on point 2 then on to 3,4,5,2,3,1,3,2 and ends on 4
on some routes there are to line like when the line goes from 3 to 1 and then back to three again. Now on the part between 1 and 3 are two lines which you can't see what i want is that my script is counting how many times a lines was drawn between two points I had this in mind to show where the lines are:

Code:
a = "1234435231";
arr_b = a.split("");
for (i = 1; i<10; i++){
j = i-1
trace("path"+(arr_b[i]+arr_b[j]));
}
Can someone help me out here

Thanks in advance..

View Replies !    View Related
How Do I Find Out How Many Lines?
I want to find out how many lines are in a text field, so I can scroll an appropriate amount.


EG:

scrolledAmount/scrollPossibleAmount * linesOfText

How can I find out what linesOfText equals?

View Replies !    View Related
Find Two Numbers In An Array That Sum To A Particular Value
So, while working on my Dictionary/Hashtable tutorial, I decided to create a more interesting example that many of you may have encountered. Basically, given a huge list of numbers, the goal is to find two numbers from that list that sum up to a particular value.

I provide an example and a more elaborate description in this link. The code for it is:

Code:
//Declaring a Dictionary
Dictionary<int, int> numberHash = new Dictionary<int, int>();

//Collection of Integers
int[] values = { 144, 29, 46, 55, 33, 64, 174, 144, 168, 129, 73, 186, 24, 163, 3, 165, 160, 79, 39, 3, 81, 175, 183, 175, 15, 150, 177, 191, 29, 106, 104, 56, 58, 85, 172, 72, 119, 192, 134, 11, 10, 54, 34, 27, 194, 182, 71, 183, 132, 147, 23, 78, 70, 13, 144, 93, 104, 177, 181, 62, 155, 26, 50, 172, 158, 17, 139, 156, 105, 26, 162, 15, 65, 30, 174, 62, 175, 182, 121, 56, 23, 77, 179, 161, 168, 36, 25, 46, 137, 178, 51, 21, 65, 41, 78, 71, 196, 142, 78, 33, 130, 81, 55, 15, 131, 145, 135, 99, 116, 104, 20, 6, 22, 201, 135, 29, 148, 71, 110, 20, 104, 89, 105, 1, 10, 9, 53, 92, 75, 112, 161, 106, 196, 60, 163, 102, 109, 182, 148, 56, 88, 47, 151, 22, 119, 97, 163, 77, 126, 16, 151, 112, 143, 15, 76, 133, 124, 49, 114, 36, 183, 64, 4, 129, 201, 197, 161, 46, 103, 36, 58, 2, 78, 199, 113, 97, 53, 149, 60, 78, 63, 50, 152, 150, 140, 113, 101, 85, 80, 123, 186, 78, 95, 105, 195, 74, 121, 44, 40, 94, 149, 34, 74, 78, 28, 166, 126, 132, 51, 15, 200, 147, 77, 170, 171, 67, 67, 52, 57, 198, 186, 152, 69, 43, 194, 12, 37, 157, 144, 128, 153, 168, 130, 121, 186, 200, 195, 192, 162, 180, 95, 94, 24, 39, 37, 131, 177, 103, 106, 62, 28, 110, 145, 67, 99, 98, 137, 56, 26, 10, 56, 152, 36, 195, 150, 3, 87, 193, 16, 128, 186, 67, 122, 196, 162, 24, 56, 12, 2, 160, 190, 84, 17, 13, 112, 11, 200, 177, 120, 26, 33, 23, 11, 176, 7, 160, 49, 177, 92, 186, 176, 161, 175, 92, 30, 172, 186, 142, 145, 76, 44, 15, 171, 56, 158, 3, 9, 172, 92, 54, 101, 197, 158, 191, 102, 157, 32, 193, 156, 164, 74, 10, 106, 91, 176, 32, 132, 69, 197, 188, 184, 109, 5, 160, 200, 116, 55, 93, 143, 26, 82, 140, 52, 176, 120, 198, 178, 125, 122, 201, 44, 56, 96, 96, 29, 175, 156, 113, 17, 18, 70, 158, 159, 193, 162, 153, 40, 67, 170, 177, 182, 40, 78, 192, 173, 151, 55, 110, 142, 155, 56, 1, 134, 134, 50, 189, 105, 158, 34, 51, 17, 98, 131, 158, 89, 57, 158, 82, 112, 95, 149, 78, 60, 31, 144, 27, 94, 4, 45, 88, 152, 157, 82, 188, 73, 67, 198, 199, 198, 123, 201, 20, 171, 8, 115, 66, 144, 190, 126, 108, 5, 12, 14, 147, 35, 52, 139, 108, 57, 2, 128, 54, 157, 145, 75, 34, 26, 63, 201, 124, 198, 42, 109, 153, 177, 47, 173, 150, 3, 143, 198, 167, 110, 66, 20, 151, 147, 115, 108, 191, 142, 123, 169, 17, 127, 197, 86, 39, 144, 10, 165, 36, 151, 179, 185, 75, 39, 86, 194, 3 };

//Value to Guess
Random randomNum = new Random();
int x = randomNum.Next(10, 200);

//Trying to find two numbers that, when added, equal the sum
for (int i = 0; i < values.Length; i++)
{
int currValue = values[i];
if (!numberHash.ContainsKey(currValue)) {
int diffValue = x - currValue;
numberHash.Add(currValue, diffValue);
if (numberHash.ContainsKey(diffValue)) {
Console.WriteLine("Two values that add up to {0} are {1} and {2}", x, currValue, diffValue);
break;
}
}
}
As you can see, the code behind it is fairly simple. The ideas behind it have applications beyond this particular example, for there are many useful things you can do when storing/retriving data is really fast.

Just copy and paste that into a main method in VS2005 or another IDE and find out which two numbers in the array sum up to a value determined during runtime. You can also choose to run the attached file after extracting it. Whatever works

Cheers!
Kirupa

View Replies !    View Related
Only Numbers In Textfield
i have a input textfield. i want it only to accept numbers (0-9)
when i press a button i want to check textfield "mep" if it contains anything other than numbers, and if it does, then tell the user "error" in textfield "report".

View Replies !    View Related
Only Numbers In A TextField
I did a restriction on a textfield in flash mx some time ago. But now, i can't do it in mx 2004. How can i do it? I need to restrict input data, to just numbers
Thanks

View Replies !    View Related
Nr Of Lines Of Textfield
Is there a way in AS2 to determine the number of lines that a textfield has ? (or the complete length and this / width would give the number of lines)

View Replies !    View Related
Textfield Lines
hello.
I am trying to sync a movieclip _height property with a dynamic textfield _height property.
The MC is just a line that expands vertically so it aligns with the bottom of the dynamic textfield as its size changes (autosize).
This textfield changes on frame events that calls diferent txt variables containing text.
here is what i have on each frame:

misson = eval("_level0/:missao");
info.htmlText = misson;
info_line._height = info._height;

Everything works fine...however when the text field becomes too big the info_line MC doesn´t align perfectly to the text, it becomes too short. Looks like there is some sort of vertical text increment that screws this up by a small but irritating amount of pixels.

View Replies !    View Related
Lines In A Textfield
How can I get a variable containing the number of lines in a textfield?

It seems simple but I can't figure it out.

View Replies !    View Related
Lines In A Textfield
How can I get a variable containing the number of lines in a textfield?

It seems simple but I can't figure it out.

View Replies !    View Related
Restrict Textfield To Only Allow Numbers And .
Hi guys.
Just trying to figure out how i can include the . in the resricted text field.
I know how to restrict to only allow for numbers, letters etc... but what i need is to only allow numbers and the dot.

How?
help file does not shed much light on this.

thanks

View Replies !    View Related
Restrict Textfield To Only Allow Numbers And .
Hi guys.
Just trying to figure out how i can include the . in the resricted text field.
I know how to restrict to only allow for numbers, letters etc... but what i need is to only allow numbers and the dot.

How?
help file does not shed much light on this.

thanks

View Replies !    View Related
Only Allowing Numbers In Textfield?
Hi!

How can i limit the textfield to only allow numbers to be inputted?

Is it even possible?

cheers!

View Replies !    View Related
Help With Displaying Numbers With A Textfield
I have gone nuts with trying to learn action script but still trying again I an new to action script and only have basic level of programming skills can any one help?

I am trying to randomly display number in a text field so that every time you hit enter it generate a new random number but I can't get the number sit in the text field...

var levelOne:TextField = new TextField();
addChild(levelOne);

var rNumber:Number = (Math.ceil(Math.random() * 10));

levelOne.text = rNumber;

trace(levelOne.text);

error " 1067: Implicit coercion of a value of type Number to an unrelated type String. "

View Replies !    View Related
Restrict Textfield To Only Allow Numbers And .
Hi guys.
Just trying to figure out how i can include the . in the resricted text field.
I know how to restrict to only allow for numbers, letters etc... but what i need is to only allow numbers and the dot.
How?
help file does not shed much light on this.
thanks

View Replies !    View Related
Devide Textfield In Lines
hello,
what I want to achieve, is that I want to split up lines in a textield. I have a multiline textfield, that I split up in separate lines with textfield.text.split("
").
this works fine for lines that are followed by the user clicking the "enter key".
But when a line is too long to fit in the textbox, the line jumps to the next line, but isn't concidered a new line.
Is there a way that i can split this up too??

Hope someone knows the answer

View Replies !    View Related
Add New Lines To A Dynamic Textfield
Hi I have a text field with(multiline and wordwrap)...What I want is that when a user clicks a button the text should appear on the 1st line of the textfield ...when clicked again it should appear on the second line of the textfield.. and so on..

In short with every click.. the desired text should appear on a new line in the textfield


Thanx

Flash MX2004 7.2

View Replies !    View Related
Split Lines In Textfield
Hi.

I have a textfield containing text on several lines. How do i separate the lines so that i can store each line in its own variable?

i have tried with split("
") , but that did not work. any other ideas?

bmolbach

View Replies !    View Related
Breaking A TextField Into Lines.
Is there a proper way to break a multiline text field with wordwrap into lines?

Here is the hack I came up with:


PHP Code:



for(var i=0; line=tf.getLineText(0); i++){
    tf.text = tf.text.substr(line.length);
    lines[i] = line;





See, getLineText(1) is undefined, because since it word wrapped, it is technically 1 line line. Thanks to my near-god-like skills, I was able compensate, but I still wonder if there isn't a better way. This way works fine, but doesn't seem to work with htmlText.

View Replies !    View Related
Space Between Lines Of A Textfield?
Hey guys.

I just got Flash CS3 and I can't seem to find the option for adjusting the space between lines of my textfields.. is there anything I'm missing or can I do it through AS?

Thanks,

Luke

View Replies !    View Related
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

View Replies !    View Related
Numbers On A Line In A Dynamic Textfield?
How do I make a loop like:

for(a=1;a<=10;a++)(
textfieldVar+=a; // this is wrong I know ;-)
}

where the textFieldVar will look like this;

"12345678910"


Regards

Godowsky

View Replies !    View Related
How To Find A World In A Textfield
hi everybody,
i have a text field i want to search a word and change it's color,
to change it's color i use TextField.setTextFormat
but how will i find the start index and the end index of the word that i want to change it?

View Replies !    View Related
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

View Replies !    View Related
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 )

View Replies !    View Related
Get Total Lines In Dynamic Textfield?
hey everyone...
I've created a scroller for a dynamic text field... I'd like to set it's visibility to true or false depending on whether or not there is a certain number of lines...
something like:

if( totalLines < x){
scroller._visibile=false;
}

how do I get the total number of lines?

As always... thanks for any help.

View Replies !    View Related
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!!

View Replies !    View Related
Limit Lines In Input Textfield
I'm trying to limit the number of lines people can enter in an input textfield.
I tried stuff with maxScroll, but that doesn't check if people press enter, so i end up with too many lines of text. I then looked at maxChars, but it's no use either, because users can still enter as many lines as they want.

Is there no way you can combine maxChars and maxScroll? there also is "textfield.onScroller" which checks if the textfield is being scrolled. Can't i use an eventhandler based on onScroller? Like:


Code:
textfield.onScroller = function() {
tekstveld.maxChars = textfield.length;
};
this results in people not being able to edit messages anymore after they reach the end of the textfield.
I have no idea how to limit the number of lines in an input textfield. Anyone?

View Replies !    View Related
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

View Replies !    View Related
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?

View Replies !    View Related
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.

View Replies !    View Related
[Q] How To Change Lines In Dynamic Textfield
Hi, I am struggling to change lines of loaded text from xml.

Basically I wrote few sentences in one child of xml file but when i loaded it to dynamic textfield I cant change the lines.

(i tried with <br> /n both didnt work, textfield was multilined)

thank you for your time

View Replies !    View Related
Total Amount Of Lines In Textfield?
Im i being a spoon here?is there a way you can find out how many lines of text there are in a dynamic textfield?I would like to display some buttons to scroll up and down but only if there is an overflow on my textfield.Is this pos?
Thanks

View Replies !    View Related
[fmx] To Limit Lines Input Textfield
is there a way to limit the user from entering more than lets say 4 lines in an input textfield?

View Replies !    View Related
Extract Lines From Dynamic Textfield
hi everyone

i have a texfield wich has wordwrap enabled and i append a text every X seconds,
after a while my textfield gets very large and that causes my movie to slowdown so when this happens i want to clear the text and just leave the last 10 lines

i know how to get the number of lines (maxscroll) but i dont know how to extract the last 10 lines.

i have searched for this in the forum but couldnt find an answer.

any clue ?

View Replies !    View Related
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)

View Replies !    View Related
Find The Number Of A Line In A TextField
Hi,



is there a way to find the number or of a line in a textField that contains a certain string?



I can find the string using
Code:
string.search();
But then I would like to find where the line is in the textfield and scroll it dynamically.



I found
Code:
numLines
but that is only the number of lines in a textField.



thanks,



Jerryj.

View Replies !    View Related
[Q] How To Find The TextField Which Uses Specific Font?
Howdy...

Quick question...

Let's just say that I have a movie that has several hundred movieClips in the library...
Some are attached on the stage manually and some are attached via attachMovie() function during the runtime...

Okay... I get to see the size report when I publish the movie and I find that I am using 'Arial Bold' font and '_sans' font... I do not recall using those fonts because I get to get the graphical symbols from the other person, for example... So, I do need to find where he used those fonts... I manually open up all the movieClips and see if I can find them or not... Sometimes I can find them, but not all the time... and it's really impossible to find them if the project happen to be a year old or whatever...

So... I am just wondering if any of you know if there is a way to find the textField that uses specific font???

Thanks...

*

View Replies !    View Related
Find Coordinates Of String In Textfield
Hi folks!
I ran into a problem I can´t seem to solve. I have one big textfield with some product names in the text.
I need to position some images next the the correct names, no matter how long the texts are, and I can not do separate textfields for each product.

So, is there any way to find out the coordinates for a specific string or word in a larger textfield?

View Replies !    View Related
Count The Lines And The Characters Per Line In A Textfield
hi,
need a method to count the lines and the characters per line in a textfield. is there a chance?
thanks.

View Replies !    View Related
Best Way To Read Out The Content Of Specific Lines In Textfield
hi,
what would be the best way to read out the content of specific lines in a textfield.
thanks.

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
Check Whether Characters In Input Textfield Are Numbers Or Letters?
I just can't get this right.
I have two textfields:inputTxt (INPUT)
statusTxt (DYNAMIC)
I have a button, which when pressed should check whether the characters entered into the input field are numbers or letters.
I have tried:

Code:
private function onMouseUp(evt:MouseEvent):void {
if (isNaN(inputTxt.text)) {
statusTxt.text = 'You have not entered a number';
}else {
statusTxt.text = 'You have entered a number';
}
}
I realise now that isNAN() only checks a variable value rather than a string value.
How does one do this?

View Replies !    View Related
Check Whether Characters In Input Textfield Are Numbers Or Letters?
I just can't get this right.
I have two textfields:

1. inputTxt (INPUT)
2. statusTxt (DYNAMIC)

I have a button, which when pressed should check whether the characters entered into the input field are numbers or letters.
I have tried:

private function onMouseUp(evt:MouseEvent):void {
if (isNaN(inputTxt.text)) {
statusTxt.text = 'You have not entered a number';
}else {
statusTxt.text = 'You have entered a number';
}
}

I realise now that isNAN() only checks a variable value rather than a string value.
How does one do this?

View Replies !    View Related
Select Text Based On Line Numbers In Textfield
Hi!

Is there any way to get character information based on line numbers in a scrollable textfield?

I'm trying to apply textformat to the text, but only for the text currently visible in the textfield, not all the text. It's a color-coding issue, and I'm trying to speed up the function.

I'd like to have a function that can return the text between, say line 3 and line 8, or maybe just the text on those two lines.

Is this possible? Any ideas?

View Replies !    View Related
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

View Replies !    View Related
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

View Replies !    View Related
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.

View Replies !    View Related
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.

View Replies !    View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved