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




Get Length Of Letters In Textfield



Hey all,
I've got a movie with a horizontal line graphic to the right of a dynamic textfield for a page title(it's pulling the text from a PHP variable).I would like the line to always follow just behind the last letter of whatever text is passed. Is there a piece of actionscript that gets the "length", or perhaps "width", of letters in a textfield so I can dynamically change the x position of the graphic?

oskom



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 06-14-2007, 08:57 PM


View Complete Forum Thread with Replies

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

Clicking A Textfield: Why Do I Have To Hit The Letters?
Hi!

I feel silly with this... problem. I made a button out of a textfield. I can click it.

But why do I have to hit the text itself to trigger the button and not any area of the textfield? I mean, if I hit the empty space of the letter "o" for example, the button does not detect the event.

How silly is that!?

Thanks for your help with this.

Random Letters On Textfield
I have several textfields, and on each one I´d like to have a random letter to appear. No ciclying, just to appear.

I´d tought about putting a letter on each frame of a movie clip and making the frame random, but maybe the letters beeing danamic could make the swf lighter.


is it possible?

Colouring Individual Letters In TextField
Hi,

I was wondering if somebody could offer some assistance as to how one would colour individual letters in a textField.

I have noticed in CS3 that you can only do this in static textFields, but you can not create these via actionscript which is what i would optimally like because i will be using a fair few of these types of objects.

Is the only possibility to make the amount I need in the FLA file and get a handle to them from the as file or is there a textClass i have missed?

Help is much appreciated!

-Mats

Addressing Individual Letters In Dynamic Textfield
Hi there,
i couldn't find anything about it, so is there a way to address individual letters in a dynamic textfield? I'd like to do some text tweenings but could not find a poper way of instanciating single letters. Of course it is possible to create a new textfield for text-values stored in an array, but this seem to be quite inefficient to me.

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?

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?

TextField Length In Char.
How can I get the width of the textfield in characters (Not in Pixels) .

INPUT Textfield Does Not Show Non-English Letters With Transparent Mode
INPUT textfield does not show non-English letters when i type, if transparent mode turn on

this is bug of Flash Player 9?
will this bug had be fixed?





























Edited: 02/18/2008 at 07:56:22 AM by Stepik_true

How To Change The Length Of Textfield Dynamically
hi,
Got a problem with dynamic textfield length.I have a flash movie which is loading text from an external text file.I have drag the dynamic text field and make its width equal to the movie length(say:550pxl) so that it covers the entire stage.I have given motion tween to this dynamic single line text field .So, that whatever the content is there in the external textfile will scroll from left to right.Now for a single line it is ok,but if there are lot of content which would exceed one line length then what to do?So, I need a script so that, the length of the singleline-textfield would be dynamically changed with the textlength,the content of which is being updated from an external file using the LoadVariable syntax.
I have attached the fla also
Neel

Determiing The Length Of Text In A Textfield?
I have a 200 pixel wide text field that will be populated with some dynamic text. I would also like to have this text be underlined so that it resembles a HTML link.

How can I determine the length of the dynamic text so that I can resize the underline to match?

Thanks in advance.

TextField Width According To The Text Length
Hi,

I have a text field in flash, where i have to fill data from xml file, and i have to attach a button just after the text, so my problem is how to set the value of the text field according to the text i have to fill on it.

for example if i have to fill "Kishor" on it, so its width should be approx 10-12 px then the button and if I have to fill "Kishor Kumar" on it then its width should be 20-22 approximately then the button will be attached,

Thanks in Advance!

Kishor kumar
kishorpapnai@gmail.com

String Length? (Textfield.htmlText)
I've done some research in Moock's Actionscript for Flash MX, but still running into issues.

I have text variables being passed into my flash movie that need to be in the same paragraph but can be one of 3 types: title, url, blank. Each one goes on a separate line.

My problem happens when I create the html string to be displayed. When I debug, the string cuts off right in the middle of a variable. Normally, if there was a problem with how I programmed the function, it would cut off before or after displaying the contents of the variable, but it cuts off right in the center of it. This happens around 250 characters into the string, which leads me to believe that something is limiting the length of the string????

Make the text string:

Code:
function makeText(){
for(i=1; i<=13; i++){ //13 is the number of lines available for display
if(_root["linksAkey_"+i] == 0){ //blank line
_root.Astring += '<BR>';
}else if(_root["linksAkey_"+i] == 1){ //title line
_root.Astring += '<FONT COLOR=#B5BD8E>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</FONT><BR>';
}else if(_root["linksAkey_"+i] == 2){ //url line
_root.Astring += '<FONT COLOR=#FFFFFF><U><A HREF=http://';
_root.Astring += _root["linksAurl_"+i];
_root.Astring += '>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</A></U></FONT><BR>';
}
}
}
Make the textbox and display _root.Astring:

Code:
this.createTextField("linksA", 10, 10, 162, 150, 209);
this.linksA.html = true;
this.linksA.htmlText = _root.Astring;
this.linksA.type = "dynamic";
this.linksA.embedFonts = true;
this.linksA.setTextFormat(_root.typewriter12);
this.linksA.multiline = true;
this.linksA.wordWrap = true;

String Length? (Textfield.htmlText)
I've done some research in Moock's Actionscript for Flash MX, but still running into issues.

I have text variables being passed into my flash movie that need to be in the same paragraph but can be one of 3 types: title, url, blank. Each one goes on a separate line.

My problem happens when I create the html string to be displayed. When I debug, the string cuts off right in the middle of a variable. Normally, if there was a problem with how I programmed the function, it would cut off before or after displaying the contents of the variable, but it cuts off right in the center of it. This happens around 250 characters into the string, which leads me to believe that something is limiting the length of the string????

Make the text string:

Code:
function makeText(){
for(i=1; i<=13; i++){ //13 is the number of lines available for display
if(_root["linksAkey_"+i] == 0){ //blank line
_root.Astring += '<BR>';
}else if(_root["linksAkey_"+i] == 1){ //title line
_root.Astring += '<FONT COLOR=#B5BD8E>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</FONT><BR>';
}else if(_root["linksAkey_"+i] == 2){ //url line
_root.Astring += '<FONT COLOR=#FFFFFF><U><A HREF=http://';
_root.Astring += _root["linksAurl_"+i];
_root.Astring += '>';
_root.Astring += _root["linksAname_"+i];
_root.Astring += '</A></U></FONT><BR>';
}
}
}
Make the textbox and display _root.Astring:

Code:
this.createTextField("linksA", 10, 10, 162, 150, 209);
this.linksA.html = true;
this.linksA.htmlText = _root.Astring;
this.linksA.type = "dynamic";
this.linksA.embedFonts = true;
this.linksA.setTextFormat(_root.typewriter12);
this.linksA.multiline = true;
this.linksA.wordWrap = true;

Link Length In Dynamic TextField
Anyone have any other hacks to get around this bug?

Flash HTML text fields and the A HREF tag ?

I have a Flash site with dynamic content and there are links that need to be long...these links point to internal pages (and need to work for an HTML version as well), so I don't like the idea of setting up a links.php file. I'm already doing that to link to Google maps and their massive urls.

I was hoping for some thoughts on a way around this?

Any ideas?

Thanks everybody!

How To Change The Length Of Textfield Dynamically
hi,
Got a problem with dynamic textfield length.I have a flash movie which is loading text from an external text file.I have drag the dynamic text field and make its width equal to the movie length(say:550pxl) so that it covers the entire stage.I have given motion tween to this dynamic single line text field .So, that whatever the content is there in the external textfile will scroll from left to right.Now for a single line it is ok,but if there are lot of content which would exceed one line length then what to do?So, I need a script so that, the length of the singleline-textfield would be dynamically changed with the textlength,the content of which is being updated from an external file using the LoadVariable syntax.
Neel

Just A Simple Question Involving Textfield.length
Hey there, i've got an input box here and submit button. Is there a way for me to set so that after a number of keypresses, let's say 9, the submit button automatically does it's action?

Scroll (compare Textfield And Text Length)
I'm dynamically creating and loading text into a textfield. Now I would like to dynamically attach a scrollbar when necessary...how would I go about comparing the length of the textfield to the length of the text?

Calculating Length Of Each Line In A Multiline TextField ?
How can we calculate the length of each line in a multiline textfield (like getting the length of the 2nd line in a 4-5 lines of text). Note that each line can be short also and if i wanted to get the length of this short line ??

Thanx in advance.......



Sandesh

Problem With Length Of Textfield When Converted To Bitmap
im using this code from the docs

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.text.TextField;

var tf:TextField = new TextField();
tf.text = "bitmap text";

var myBitmapData:BitmapData = new BitmapData(80, 20);
myBitmapData.draw(tf);
var bmp:Bitmap = new Bitmap(myBitmapData);
this.addChild(bmp);


the problem is when i make the string longer - there are characters missing in the Bitmap - ive used the TestFormat to no avail

any one any ideas
tks
M

Horizontal Scroll For Textfield If >field Length?
OK, here is my problem.

I have a .swf that is loading data via XML and populating each "result" with a title, data, image, etc. WELL, for the title I only have like 150 pixels available. So what I want to be able to learn is how to take that dynamic textfield for the Title and IF the title length is too long for the textField then scroll it back and forth.

Does that make any sense??


And if the answer/suggestion involves any sort of textField masking I would appreciate it if you had a link to a tutorial on something like that.....never been able to do it! lol


Thanks tons Kirupa!!!

Horizontal Scroll For Textfield If >field Length?
OK, here is my problem.

I have a .swf that is loading data via XML and populating each "result" with a title, data, image, etc. WELL, for the title I only have like 150 pixels available. So what I want to be able to learn is how to take that dynamic textfield for the Title and IF the title length is too long for the textField then scroll it back and forth.

Does that make any sense??


And if the answer/suggestion involves any sort of textField masking I would appreciate it if you had a link to a tutorial on something like that.....never been able to do it! lol


Thanks tons Kirupa!!!

Horizontal Scroll For Textfield If >field Length?
OK, here is my problem.

I have a .swf that is loading data via XML and populating each "result" with a title, data, image, etc. WELL, for the title I only have like 150 pixels available. So what I want to be able to learn is how to take that dynamic textfield for the Title and IF the title length is too long for the textField then scroll it back and forth.

Does that make any sense??


And if the answer/suggestion involves any sort of textField masking I would appreciate it if you had a link to a tutorial on something like that.....never been able to do it! lol


Thanks tons US!!!

cheerz

Convert The Letters To Lowercase ONLY If They Are Actually Letters, Not Numbers?
I have a glitch with this line of code:

one_array.toLowerCase();

in a dynamic input textbox. If the string includes a "!" it becomes a "1" .

Is there a way to only convert the letters to lowercase if they are actually letters - not numbers or punctuation? Do I have to write a line of code for each character, or is there an easier way to do it?

Video Length Does Not Match Music Length
I want to have a 3 minute wav file loop infinitely over a 20 second flash video which also loops infinitely. The only way I have found to do this is to copy and paste the video so it repeats itself for 3 minutes, then the whole thing loops. Is there a way to run my 3 minute wav file in the background of my 20 second video conveniently?

Here is an example of what I have already made:
http://www.limdallion.com/Characters/Pyk/Pyk.shtml

Mp3 Sound Length And Played Length
hey i have an mp3 players, is a lot of code so im not going to post it all at.
but what i want is something to tell me the length of the sound and the current playing time..

well i will post this much of the code that i made i just don't know how to turn it into minutes and seconds.


Code:
private function onEnterFrame(event:Event):void
{
// this is the total estimated time
estimatedTotal = Math.ceil(snd.length / (snd.bytesLoaded / snd.bytesTotal));

// this is how much the sound played in %
position = Math.round(100 * (sc.position / e));
// i was just testing with aprogress bar
run.setProgress(p, 100);
}
so how i turned this code that works into minutes and seconds.

Mp3 Length Don't Match Timeline Length
I got myself a simple setup - an animation playing against an audio track. I've used 'use imported mp3 quality' in the export dialogue box. I've got a root timeline of 814 frames long. At 25 fps this gives me a timeline length of 32.5 seconds - this should be the same length as the mp3.

however the mp3 finishes about 5 seconds before the timeline?

How are you meant to sync audio to animation if there is that much discrepency? I haven't got anything processor intensive on the timeline.

Replacing Letters With Other Letters
I am trying to make a simple encryption tool and i was wondering how i could use code to replace text, with somewthing totally different!

Transforming Letters To Letters..? Is It Possible?
do you guys know if its possible to transform letters into a different letter because i'm sorta stuck thx for your help

Difference Bw Array.length() & Array.length
Hello

I have a question about AS3 array length method. sometimes if you use array.length() it gives error while other times it works fine and same is the case with array.length can anyone explain the difference please?

Loading Text & JPG Nito TextField Makes Textfield White
Hi guys !

Does anyone know, why a textfield may become white when loading text + JPGs into it? Sometimes it happens to me, sometimes not. I haven't figured out why.

If you have any clues... I'd be really thankful

The AS I'm using:

_target.container.t.html = true
_target.container.t.condenseWhite = true
_target.container.t.autoSize = "left";
_target.container.t.htmlText = _data.texto

The String ( &HTML ):

"Text lorem ipsum bla bla ..... <img style='WIDTH: 154px; HEIGHT: 59px' height='298' width='856' alt='' src='http://www.spacilong.com/arq/img/AlcatelLucent_Hor_2col_sm.jpg' />

I Need To Know How Much Letters
help!!!
I need to know how much letters are into a specific line of a dynamic text string...for exampe:
FirstString = .....lenght;
SecondString= .....lenght;
etc....

Letters And ASP
I have a strange problem.
I'm working on this website where we combinate Flash and ASP.
Everything is working fine, except that we can't use the special letter for the norwegian language.
On the other way we can "hardcode" it in flash and it's working there. We can set a variabel with these letters, and it's working. But we get problems when we read from the ASP script.

Here is some of the code.
function getnewsText()
{
var n = new LoadVars();
n.newsheading = nyhetvalg;
var m = new LoadVars();
m.onLoad = getResponse;
n.sendAndLoad("news/maintext.asp", m, POST);
}

Anyone who have had that problem?
I'm pretty confused and I'm not shure that the problem is in the Flash file or the asp script file.
It's seems that is working both places but not together.

I hope somebody can help me.

Remi

'dot Letters' Ö Å Ä MX
Hi
Odd question for those who write in english but when i import text from a .txt file
onClipEvent (load) {
this.loadVariables("pajala.txt");
the 'dot letters' ä ä ö shows as boxes http://ullvitorget.koping.se/~JTR/test/pajala.swf
When i write text in actionscript there is no problem? Why?
// Roland

Using Letters
I need the code to make it so when I press "w" something happens.

Textfield Woes, How To Anti-Alias A Dynamic Textfield?
this is driving me nuts, even if i have it marked so that my dynamic textfield is anti aliased, it still looks as if its text is aliased. And if i simply make that textfield Static, the text all of a sudden looks amazingly crisp and anti aliased.

How can i fix this?! I am attempting to load xml data into my text fields but its wasted if the text looks like crap..

So can anyone enlighten me on how to do this? i tried searching Flashs help, all i came out with was "Textfield._quality" but i do not understand what the description means exactly.. And i tried coding my textfield to _quality = "BEST";, with no avail.

Please help, i'v seen other websites with what i am sure is dynamically loaded fields, and smooth looking text... so what gives?

Thanks!

[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.

I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.

I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.

Anyone got a better idea?

Cheers
Paul

[textfield] How To Check If Input Text Is More Than Textfield Height?
Hi guys, Is there a way to check if the text that has been input into the textfield is more than the height of the textfield.

I have set the scrollbar hidden and it will become unhidden once the text is greater the the textfield height.

I did try to count the input text and set the visiblity of the scrollbar against that count. Unfortunatly this is unreliable.

Anyone got a better idea?

Cheers
Paul

Link In Dynamic Textfield To Jump To Section Of Same Textfield
Howdy all,

I know you've all seen this before - you are on a website and you click a link and you stay on the same page but jump down to a different section of the page. Like an FAQ page or something where all the questions are listed above but you click on one and jumps down to the answer below.

Is it possible to do this in a dynamic (scrollable) textfield with externally loaded text files in Flash? I don't have DW and I know that there are limited html tags available but if anyone knows an easy way to do this please let me know!

thanks!

After Killing The Focus On A Textfield, The Textfield Remains Selected. Why ?
Hi.
I have a serious problem with the deselecting text when I kill the focus on a textfield.
to see better what I am trying to say, please clcick this link: http://www.eurogaz.ro/rring/expert/

Link In Dynamic Textfield To Jump To Section Of Same Textfield
Howdy all,

I know you've all seen this before - you are on a website and you click a link and you stay on the same page but jump down to a different section of the page. Like an FAQ page or something where all the questions are listed above but you click on one and jumps down to the answer below.

Is it possible to do this in a dynamic (scrollable) textfield with externally loaded text files in Flash? I don't have DW and I know that there are limited html tags available but if anyone knows an easy way to do this please let me know!

thanks!

Submiting Letters
I want to make an internet site where my friends can get to write on a flash interface so whatever they write appears on the page, like writing open letters or something like that.. do you know what i mean?? It's kinda like this i'm doing right now, i write this thread and it gets published.... PLEASE!!!! someone :-)

Shaking Some Letters.....
Hi

I'm trying to have a bunch of random letters in a circle. You can grab this circle and move about the screen - which makes the letters look like there being shaken....but what i've done is very rigid....the letters follow the circle to but it hasn't got a random like feel......any help would be appreciated.

thanks

What Do The Letters SWF Stand For Exactly?
A simple query. I know that it is the flash file format.
Does it stand for scalable web format?
Thanks in advance Sebastian

Test For Cap Letters
is there any way to test if a particular substring is a capital letter? I would rather not do 26 if else statements....

thanks

? Spanish Letters ?
Hi, i need to use spanish letters (some of them have minor drawings above them).
Do i put them inside the "Embed Fonts" in the "text options" window and that will do?

Thanks in advance,
Maya.

Shuffle Letters
Hi all!

I have a variable = "REFERENCER".
I want to have each letter to shuffle around randomly at the
same time. After a certain amount of time, each letter ends with the right letter. (REFERENCER).

It should be something like this example, but only the letters should change at the same time.

http://www.flashkit.com/movies/Effec...32/index.shtml

Scandinavian Letters
This time I have a big problem. I am loading text dynamicaly from a *.txt file. This i ok. The problem is when I type any "scandinavian letters" like Æ Ø or Å they appear as squares in the text-field. I really want to have this letters because not everybody who is reading my page can speak English.

Is this possible? I am sure our asian friends has the same problem..?

Is there a way to work around this?

Happy flashing, Metaman

My .TXT Does Not Show Some Letters
ok guys here it is.
i all ready know how to load a .txt file into a dinamic textfield in flashMX. The thing is that i´m trying to load a spanish peace of text that has some á,é,í,ó,ú and the Ñ letters. When i upload the .txt file, it does not show those letters in my movie.

Thank you guys, i going nuts with this little problem.

Jagged Letters
How can I make my text look more smooth? Even when I have it set as Static Text it looks jagged.

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