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




MultiLine TextField



Hello!
i have a small but very strange problem .
i would like to create an autosize textField..

ActionScript Code:
var my_txt:TextField=path.createTextField("my_txt", depth, __x, __y, __width, __height);        my_txt.autoSize = "justify";        my_txt.selectable=isSelectable;        my_txt.wordWrap = true;        my_txt.multiline = true;        my_txt.text = textToDisplay;
wich is still impossible is that my text field could be multiline without giving it the max height for the estimated number of linees.
else flash shows a single line !!



Ultrashock Forums > Flash > Flash Professional
Posted on: 2006-03-01


View Complete Forum Thread with Replies

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

TextField.multiline Or TextField.wordWrap
i know TextField.multiline.
actually, i don't know what is difference if the text's multiline is true.

i used to set text wordWrap is true without multiline

Or Or Both For Multiline Textfield?
when using a variable to fill a multiline text field, I am using
or
for the line breaks.

I'm on a PC and it interprets them both as line breaks (so that you go down two lines if using both) but I seem to remember that a Mac needs both of these escape codes to create a single line break.

I don't have access to a Mac at the moment - could someone please try it out? Or does someone know how this works?

thanks in advance - n.

Multiline Textfield With Newlines
Hi all,

I am currently working on some little things in Flash in connection with PHP like sending e-mail etc.

My problem is the multiline textfield. When I have carriage/returns in my text and send this text to the PHP file I get the text without the carriage/returns... I tried nl2br($text) in PHP but it stays the same.

Does anybody know how to solve this?

Thanks,
Stefan

NO Scrolling On Multiline Textfield...
HELP!!! (please)

I need help. I need to make a multiline text field that does not scroll, it just stops letting you type when you have filled the text field up!

I could set the text field to limit chars, but that doesn't solve my problem, because the users will be using the return carage, and that would still allow them to type past the bottom of the text field. I just need to limit them to 20 rows, and 40 coloms of text. is there an actionscript way?

I am using flash 4, but would be willing to use 5, or MX if I need to to make this work.

Any one have any idea? Thanks!

TextField, No WordWrap, No Multiline
Hey Gang,

My text field does not seem willing to wordWrap or multiline. Can someone tell me what is wrong with this?

this.createTextField("question_txt", 1, -240, -53, 445, 0);

question_txt.text= _root["question_" +_root.randNum][0];

question_txt.setTextFormat(_root.formatColor);

question_txt.setTextFormat(_root.formatSize);

question_txt.setTextFormat(_root.formatFont);

question_txt.multiline= true;

question_txt.wordWrap= true;

question_txt.autoSize= "left";

TextField.multiline Properties.
Here is a weird one....

I created a TextField dynamically set the .multiline = true; (it only takes Boolean values). Now I tried to TextField.autoSize = "left"; and it doesn't really work because multiline, when set dynamically, is set to multiline no wrap.

Well that sucks, because the TextField won't expand vertically.

Oh well, I guess just make a dummy clip on the Stage and adjust that.


Quote:




If the value of autosize is "left" and the text field line type is set to Multiline in the text Property inspector, then the text field expands or contracts its right and bottom sides to fit all contained text.

If the value of autosize is "left" and the text field line type is set to Multiline No Wrap in the text Property inspector, then the text field expands or contracts only its right side to fit all contained text.

AutoSize Multiline Textfield?
Hello, does anyone know if it is possible to autoSize a multiline textfield?
In the examples of Adobe they use a single line textfield.

For example, if you draw a very wide en very hight textfield on the stage and you check multiline and
check the textfield background color and use this as code:

your_txt.text = "Hello world";
your_txt.autoSize = TextFieldAutoSize.LEFT;

The height will be autoSized to one line, but the width still keeps the same.

You probably think, why don't you use a single line? Well, what if my text is more then one line?
Then you would get a very long sentence.

Anyone has an idea on this?

Centering Multiline Textfield
Hey

Ok yet another issue..

Trying to center a multiline textfield, meaning all the lines are centered.

var = "<p align="center">text1<br>text2</p>"

This actually center both lines, but the line that has the longest text is all blurred where as the other one is crisp clear.

Appearently you can type in the both lines manually and center it in TEXT PROPERTIES. Is there a way in action script (when not rendering HTML) to insert a text that spans on 2 lines, basicly like you can with HTML using the <br> tag??
Or is there a fix for the problem when using html render to make sure both lines are crisp clear??

Thanx

AS 2.0 Textfield Multiline Help Needed
hi guys
i am generating the following text box and the data in it dynamically:

_root.createTextField("recipe"+i+"_txt", _root.getNextHighestDepth(), 5, 100, 600, 400);

the problem i am having is the text that is generated only stays on one line and therefore doesn't fit into the text field.

i know there is a way to add the multiline property to other types of components but can this be done dynamically? if so can someone help me out and let me know!

thanks in advance, Dave

Centering Multiline Textfield
Hey

Ok yet another issue..

Trying to center a multiline textfield, meaning all the lines are centered.

var = "<p align="center">text1<br>text2</p>"

This actually center both lines, but the line that has the longest text is all blurred where as the other one is crisp clear.

Appearently you can type in the both lines manually and center it in TEXT PROPERTIES. Is there a way in action script (when not rendering HTML) to insert a text that spans on 2 lines, basicly like you can with HTML using the <br> tag??
Or is there a fix for the problem when using html render to make sure both lines are crisp clear??

Thanx

TextField - Html - Css - Multiline Safari
The following problem occurs only, as I know, on Safari, on Macs.

I import html pages with an XML object, and display them in text fields, with Cascading Style Sheets. The text field is html, multiline. In Safari, the wrapping (breaking of the lines) doesn't happen at the right place. Some word are cropped.

Do you have an idea of the cause of the problem, or even better, of the solution?

Thanks

Bert

Spacing Problem In Multiline TextField
Hello, everybody! This is my problem: I have a dynamic multiline textField, and I use htmlText to add some simple text and an <a href=.. > link in it. Everything is ok, it works, but if I hover the mouse over the link, and the underline appears, some of the text is displaced with about 1 pixel

I tried to use &nbsp; instead of spaces, but It seems this doesn't work. The characters are recognized, but they're not shown and I am left with no spaces at all. Anyway, I don't think &nbsp; would be a solution to the initial problem even if it worked, because even the spacing INSIDE words changes on mouseOver.
I think it's because the textField is multiline and flash needs to calculate where to start a new line..

This moving text looks pretty bad, and it's annoying. Do you know any solution?

Recieves Only First Line Of Multiline Textfield In Asp
Hey

I have a form in flash where I send variables to ASP which sends an email. Everything works fine except for one thing;

The message-box which is a input-field with multiline only sends the first line of text to the ASP-script. Why is that?

/martin

Line Break With Indexof On A Multiline Textfield
I made a text field that can determine what line the user is on by looping through it and comparing it to the caret position...

i use the indexOf to determine where the linebreak is on the textfield but im not sure what ActionScript uses as a linebreak... my code works if i use "1" at the end of everthing i write and check by "1" so im sure everything else works in my code... i have tried the following and none has worked...

indxVal = strBody.indexOf('
', lastIndexVal+1);
indxVal = strBody.indexOf("
", lastIndexVal+1);


the lastIndexVal is the previous indxVal so it will skip the next one every loop...

Note: This code will work if i use "1" and end every line with a "1" so everything else is working... i think the textfield might use a different character than the '
'

Thanks in advance everyone!

Vertical Centering Text In Multiline TextField
Does the TextField class support automatic vertical centering of multiline text? Any way to control vertical alignment other than "flush top"?

It seems like it ought to, but if there is a method or property in the class that turns it on, I can't find it. (Maybe a case of not being able to see the trees for the forest, there's so much junk in there, plus the TextFormat...)

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

Width Of Text On The Last Line Of A Multiline Textfield
Hi all,

Does anyone know a method to get the width of the last line (the width of the actual text on that line, which may be less than textfield width) of a multiline auto-wrapped text field ?

The problem is that as far as I know, Flash wraps text internally, and there is no way of actually finding out the value. I had to use hacks like adding characters like "i" to the line and testing if the line broke and then measuring the width of the "i"'s and thus by substracting that from the total text field width, I would get the width of the text on the last line. The technique is rather slow, though, so I am looking for an alternative..

Tanks!

Multiline Dynamic Textfield Autosize Not Working?
I am trying to autosize a Multiline Dynamic Textfield, but it doesnt work...if i change the textfield to a single line, my AS autoSize=true works fine...but if its set to be a multiline it doesnt shrink if the text is smaller than it.

How do i get my multiline textboxes to shrink to be efficient, so theyre only as big as the stuff in them?

Dragged Distance? Multiline Textfield Height?
1. How can I detect the distance I have draged my object to run an action rather than using a hitTest?

2.how do you get the height of an external loaded text with multiline?

i keep tracing small numbers that maybe represented just a line?

Multiline Input Textfield Doesnt Work In Browser Maxthon-2
Hello, I find it weird...

I've realiced that multiline textfields doesnt propperly work under Maxthon-2 browser (based in IE). The enter key doesnt work as expected, jumping to the following line, while the same SWF embedded in the same HTML work perfectly while playing the movie under IE or Firefox.

why?

Thanks for your help

Cs3 As2 - How To Detect Newlines In Dinamically Loaded Wrapped Multiline Textfield
Hi everybody, this is my first thread on Kirupa forums so please excuse my awkwardness.

I have the following composition from my designer:



So, I have to load these two HTML paragraphs from an XML file and put them in two actionscript created text fields. The text fields are multiline, wrapped and html and they are displayed just fine. Then I have to hilight one of the textfields just like in the image above so I must define a function that takes this textfield as an argument and creates a movieclip behind it. All I have to do further is draw some lines in this movieclip.

The problem is I just can't detect the newline characters in the text field so I can draw the hilights from the start of each line to the end of it.

Here is my function:


function hilight(sapou_txt){var hilight_mc = sapou_txt._parent.createEmptyMovieClip("hilight_mc",-1);
hilight_mc._x = -5;
hilight_mc._y = sapou_txt._y;
}


There would be .indexOf("") method of strings but if I use it after sapou_txt.text this has no result because, apparently, all I have there is a string without any special newline characters, just as I loaded it from the XML file, minus HTML tags.

If I use sapou_txt.htmlText apparently I get the original text including the HTML tags but, again, no special newline characters and, as you probably realised from my description above, I need both newlines from HTML (wich are not so hard to detect) and newlines caused by wrapping text in the textfield. Anyway, if I succeed in detcting newlines in the text field then I won't need the newlines in my original HTML.

Anyone had the same problem or know how to solve this, or know other way to draw those hilights behind every line in my text?

Multiline
How can I set multiline with a textfield by using AS?
I type below but it is sigle line as before.

Code:
_root.createEmptyMovieClip("newMC", 1);
with (_root.newMC) {
createTextField("character", 2, 0, 0, 100, 50);
character.multiline = true;
character.text = "djkfldlkdsflkdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdalfjdklshfjdjfkl";
}

Multiline
Hi all,
Is there a way to restrict the text input multiline?
I would like to say that you can only use up to 15 lines.
Thanks for your help.

Multiline From Xml
here's an odd one
I want to add miltiline text from an xml tag but as soon as I put it to flash, the /n and /t just don't work, how can I go around this ?

Xml Multiline?
hi
i have dynamic text boxes that retrieve text information from an xml file. Everything works great except that it doesnt seem to understand that there are line breaks in the xml code:

<body><![CDATA[text <br>goes<br />here]]></body>

i have MULTILINE and RENDER AS HTML on on all text boxes and i have also embedded the fonts to enable masking of the text boxes

help please, im using AS2

Multiline Var Loading
Is it possible to load multiline variables with LoadVariables; if yes, what's the form?

Thanks

Multiline Text
I would like to create text via actionScript, but if the text has more than one line, and I can't do it...

If I use the textTool to create text (an empty box) and name it myText, and choose multiline in the property inspector, I can do it...:
_root.myText.text = "how to create multiline text?"

works just fine...

but if I do this:
_root.createTextField("myText", xPos, yPos, w, h);
_root.myText.text = "how to create multiline text?"
_root.myText.multiline = true;

it doesn't work...
what am I doing wrong?

Multiline Listbox
is this possible. can you get more than one line per option in a listbox? if so how?

Multiline TextBox
I would like to know how to go the last line of a multiline textbox without using the SCROLL

Multiline Problem?
I have a dynamic text box and have set the following so the text written to it will break to a second line if need be.:

textBox_txt.multiline = true;
textBox_txt.wordWrap = true;

On the Mac it's fine however it doesn't break on a PC.

Any suggestions?

Multiline Array
I have created a group of buttons used in turn to create an array. It works fine, but what I can't figure out how to do is to get the items of the array to print on individual lines like:

Milk
Butter
Bread

rather than on one line separated by commas like:

Milk,Butter,Bread

How do I do this?

Also, is there a way to specify line spacing between each item once they've been placed on individual lines?

Here is the code that I have so far ...

var shopList:Array=new Array();
var i:Number=-1;

milk_btn.onRelease=function() {
++i;
shopList[i]="Milk";
}

butter_btn.onRelease=function() {
++i;
shopList[i]="Butter";
}

bread_btn.onRelease=function() {
++i;
shopList[i]="Bread";
}

enter_btn.onRelease=function() {
items_txt.text=shopList;

}

Thanks!

Multiline Concatenation
hi guys,
i was wondering if you can add on to a string in a new line, like in php it would be:

Code:
$a = "Hello ";
$a .= "World!";
i know i could do it in flash as


Code:
a="hello";
b="world";
c=a+b;
but i want to add to a string each time in a loop so it would ideally be something like:

Code:
a="blah blah blah"
for (i=0; i<=30; i++) {
a .="blah"+i
}
thanks guys,

[F8] WordWrap Vs MultiLine
Code:
function makeTxBox() {
holder = box._parent;
var txField:TextField = holder.createTextField("txField", 5, 0, 0, box._width,box._height);
txField._x = box._x;
txField._y = box._y;
txField._width = box._width;
txField._height = box._height;
txField.selectable = false;
txField.setNewTextFormat(txStyle);
txField.multiline = true;
txField.wordWrap = true;
txField.text = entryText;
init();
}
hopefully that is all you need to help. Essentially, each empty mc on my stage has a txField and a box (for background) inside. The txField rests above the box. The text is loading fine, positions look great...but the text is not wrapping....or multilining (if there is a diffrerence, that explanation could be icing)!

Multiline In Text Box?
hi guys!

i have a dynamic text box called "myTextBox"

in my button i have this:

_root.myTextBox.text = "this is a line";


what im wanting to be able to put new lines in like when you press enter when writing text.

so the result would be somthing like this:

-----------
this is line 1
this is line 2

this is line 4

etc
------------
how do i go about this?

thanks

Help With Multiline Tabstops
Hello all,

Is there a way to have multiline columns within a textfield? I have the following code:


Code:
// Create a new text field to hold text. NOTE the UI scrollbar must be on the second frame
// becasue the textfield created here must first be created before the uibar instance
this.createTextField("table_txt", 99, -26.1, -13, 345, 166.5);
table_txt.multiline = true;
table_txt.html = true;
table_txt.wordWrap = true;

// Creates column headers, formatted in bold, separated by tabs.
var rowHeaders:String = "";

// Creates rows with data.
var row_1:String = "<FONT FACE ='Verdana' SIZE ='12'><b>BSI </b> Gloves and eye protection</FONT>";
var row_2:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Scene Saftey</b> Scene is safe</FONT>";
var row_3:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Resources</b> 3 person aid crew, ALS crew added if needed</FONT>";
var row_4:String = "<b>-----------------------------------------------------------------------------</b> ";
var row_5:String = "<FONT FACE ='Verdana' SIZE ='12'><b>CC/MOI</b> MVA, decreased LOC</FONT>";
var row_6:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Respirations</b> 20</FONT>";
var row_7:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Pulse</b> Radial at 110, strong</FONT>";
var row_8:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Mental Status</b> Awake, but has difficulty with attention</FONT>";
var row_9:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Skin Signs</b> Cool, moist, pale</FONT>";
var row_10:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Obvious Trauma</b> None</FONT>";
var row_11:String = "<FONT FACE ='Verdana' SIZE ='12'><b>Blood Pressure</b> 112/palp (later 120/74)</FONT>";

// Sets two tabstops, at 25 and 100 points.
table_txt.htmlText = "<textformat tabstops='[25,120]'>";
table_txt.htmlText += rowHeaders;
table_txt.htmlText += row_1;
table_txt.htmlText += row_2 ;
table_txt.htmlText += row_3 ;
table_txt.htmlText += row_4 ;
table_txt.htmlText += row_5 ;
table_txt.htmlText += row_6 ;
table_txt.htmlText += row_7 ;
table_txt.htmlText += row_8 ;
table_txt.htmlText += row_9 ;
table_txt.htmlText += row_10 ;
table_txt.htmlText += row_11 ;
table_txt.htmlText += "</textformat>";


This works great with the text populating two columns. But the 2nd column in row_3 and row_8 drops down to the next line, but does so in column 1.

Is there a way to have it drop a line but align with the 2nd column tabstop?

Thanks for any help

Greg

<--- Multiline Textfields --->
This i wat i do:
I have a multiline text field - I record the contents using asp. I pass the contents of the field thru the Query String to the page.

This is the problem
When the contents get copied thru the query string it loses all return carriages. This is a big problem as it is an address i am recording

What i need?
Is the replace the return cariages with <br>'s and then pass it thru the query string?

What is the character code for return cariages?

Thanks in advance.

Returns In Multiline Being Sent To XML
ok....dumb question here.

i have a multiline text box for users to enter a short message into.

when they hit <enter> as they are typing what character are they creating? would this be a "/n" or a "/r" ?

its my xml file ends up looking like this:

Code:
<message> blah blah bla

blalbhal

blah
</message>
....i would ideally like these invisible returns to be replaced....any ideas?

robocop

Multiline Graph
anyone knows how to create a multiline graph with the 12 months on the x axis nd value from$20,00 to $40,000 on the y axis?? ?

HTML Multiline?
Hello, I have a question..... again.. jaj. Its just that Iam frustrated with this work I am doing..

Ok, the question is if its possible for a textField to be multiline when it works as html, because I have the property for multiline enabled, but with no results.

This was added: I forgot to mention something important. The text in the textField is being loaded from an external file, all the html code is there. There are parts in the code that use bullets, and if I use a <br>, a new bullet is created, and the message will not make sense separated by unecessary bullets.

CreateTextField And Multiline
I'm trying to make a dynamic text field multiline, and for some reason, it won't work. I can see the text, but it doesn't multiline.

I'm creating a text box inside an empty movie clip. TextClip1 is the empty movie clip.


ActionScript Code:
with(TextClip1)
    {
    createTextField("TitleBox", 1, 0, 0, 300, 100);
    with(TitleBox)
        {
        text = recArray[0].Title;
        selectable = true;
        multiline = true;
        setTextFormat(TitleFormat);
        }
    }

When I review my variables, nothing appears to be wrong. the multiline is set to true... so I have no idea what is going wrong.

Multiline Problem?
I have a dynamic text box and have set the following so the text written to it will break to a second line if need be.:

textBox_txt.multiline = true;
textBox_txt.wordWrap = true;

On the Mac it's fine however it doesn't break on a PC.

Any suggestions?

Detect Multiline
Hi, I've created a search device and some of the results shown have more than one line (or more than one result). From the following function, how can I tell if more than one item has been added to the results field?









Attach Code

function fChkInput():Void {
if (_root.searchPanel_mc.result_txt.text == "") {
for (i=0; i<aAllNames.length; i++) {
if (aAllNames[i] == sSearch || aAllNames[i].toLowerCase() == sSearch) {
searchPanel_mc.result_txt.htmlText += aAllListings[i].attributes.extension+" "+aAllListings[i].attributes.cell+" "+aAllListings[i].attributes.email;
} else {
//searchPanel_mc.result_txt.text = "Not found";
}
}
}
}

Problem With The Multiline
I have problem with the multiline. The problem is that I have put multiline to true, but the text is still on one line?
Please help me!!!


Code:
_root.createTextField("start_txt",300,300,50,400,200);
start_txt.text = start_info;
start_txt.border = true;
myStart = new TextFormat();
myStart.color = 0xFFFFFF;
myStart.font = "arial";
myStart.multiline = true;
myStart.type = "dynamic";
start_txt.setTextFormat(myStart);

Damned Multiline
Code:
this.bg.attachMovie("vidbg_mc", "vidbg_mc", this.getNextHighestDepth());
this.createEmptyMovieClip("holder", this.getNextHighestDepth());
// text field
var whichfile:String = vidfileArr[i];
var whichlabel:String = vidlabelArr[i];
var whichthumb:String = vidthumbArr[i];
var whichdesc:String = viddescArr[i];

this.holder.createTextField("label_txt", this.holder.getNextHighestDepth(), 68, 5, 160, 60);
this.holder.label_txt.multiline = true;
this.holder.label_txt.text = whichlabel+"
"+whichdesc;
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.size = 11;
myTextFormat.bold = false;
myTextFormat.color = 0xFFFFFF;
this.holder.label_txt.selectable = false;
this.holder.label_txt.setTextFormat(myTextFormat);

//*/

// Preload thumbnail
this.holder.createEmptyMovieClip("vidthumb_mc", this.holder.getNextHighestDepth());
mcloader.loadClip("newsite/kaleo/video/thumbs/"+whichthumb, this.holder.vidthumb_mc);
// button functions
this.holder.onRelease = function(){
// load video
//_root.vids_mc.vidnav_mc.header_txt.text = whichlabel;
trace(this);
ns.play("newsite/kaleo/video/flv/"+whichfile);
}

for some messed up reason I can't get the text boxes to display multiline... this bit of code is from a movie clip prototype function. syntax seems to be alright, anybody know what would cause this not to work?

Multiline Alert
Hi, i was wondering how you display multilines in the alert component.

e.g.

The following errors occurred:

- You didnt fill in a username
- You didnt fill in a password
- etc
- etc

Any ideas??

Regards,

Martin

Computing Help And Info:
http://www.webrevolt.biz

Multiline Textbox
I am trying to create a multiline text box but am only getting the first line of text

     textStr = str1 + "
" + str2;

         txt.setNewTextFormat(nameTextFormat);
     txt.selectable = false;
     txt.embedFonts = true;   //necessary for next line
     txt.multiline = true;
     txt.wordWrap = true;
     txt.text = textStr;

RadioButton Multiline
Can a radioButton have a multiline setting for the label. I'm using Flash Pro MX 2004.  I can't find a way to do it, so i was just wondering if that is possible.  Thanks.  

End Of The Line In The Multiline Text
Hi!

how can I find the end of the line in the multiline dynamic text field??
I need the index of the first character at the last line..

thanx in advance

Multiline Input Text
I want to create an input box with multiline property and when I press "Enter" key in the input box, the cursor will go to next line even though the cursor has not reached the end of the box width. Therefore the user can input any text and wrap at any point.

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