[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
ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)
Posted on: 06-29-2005, 05:45 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[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
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?
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
code: textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
code: textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
ActionScript Code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
</p>
<p>holder.attachMovie ("newsMc", "news" + i, i);</p>
<p>holder['news' + i]._y = nextY;</p>
<p>nextY += Math.ceil (holder['news' + i]._height) + 2;</p>
<p>
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
</p>
<p>if (i > 0) {</p>
<p>j = i - 1;</p>
<p>trace (j + " text height=" + holder['news' + j].newsStory._height);</p>
<p>if (holder['news' + j].newsStory._height > 184) {</p>
<p>nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p>} else {</p>
<p>nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p>trace ("nextY=" + nextY);</p>
<p>}</p>
<p>
But this still returns the intial height
Here is the complete code
ActionScript Code:
</p>
<p>for (i = 0; i < this.newsCount; i++) {</p>
<p> holder.attachMovie ("newsMc", "news" + i, i);</p>
<p> holder['news' + i]._y = nextY;</p>
<p> holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];</p>
<p> holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];</p>
<p> holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];</p>
<p> nextY += Math.ceil (holder['news' + i]._height) + 2;</p>
<p> if (i > 0) {</p>
<p> j = i - 1;</p>
<p> trace (j + " text height=" + holder['news' + j].newsStory._height);</p>
<p> if (holder['news' + j].newsStory._height > 184) {</p>
<p> nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p> } else {</p>
<p> nextY += Math.ceil (holder['news' + j]._height) + 2;</p>
<p> trace ("nextY=" + nextY);</p>
<p> }</p>
<p> }</p>
<p> unloadMovie (dtLoader);</p>
<p> viser._visible = 0;</p>
<p>}</p>
<p>
Cant Get Textfield Height From AutoSized Textfield
Afternoon guys.
I am creating a new nwe3s blogger. Instead of relying on a scrollbar to scroll the news story i thought i would use
ActionScript Code:
textField.autosize="left"
This works fine...
At present i am loading x amount of news into flash at any one time. I am placing the news story underneath each other using
ActionScript Code:
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
nextY += Math.ceil (holder['news' + i]._height) + 2;
this is fine...
But when i use
ActionScript Code:
textField.autosize="left"
nextY retains it's orginal height even though some of the news stories have made for higher textfields.
I thought i could pull the height from the previuosly created news holder
ActionScript Code:
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
But this still returns the intial height
Here is the complete code
ActionScript Code:
for (i = 0; i < this.newsCount; i++) {
holder.attachMovie ("newsMc", "news" + i, i);
holder['news' + i]._y = nextY;
holder['news' + i].newsTitle.text = this['news' + i + 'newsTitle'];
holder['news' + i].newsDate.text = "Submitted: " + this['news' + i + 'newsDate'];
holder['news' + i].newsStory.htmlText = this['news' + i + 'newsStory'];
nextY += Math.ceil (holder['news' + i]._height) + 2;
if (i > 0) {
j = i - 1;
trace (j + " text height=" + holder['news' + j].newsStory._height);
if (holder['news' + j].newsStory._height > 184) {
nextY += Math.ceil (holder['news' + j]._height) + 2;
} else {
nextY += Math.ceil (holder['news' + j]._height) + 2;
trace ("nextY=" + nextY);
}
}
unloadMovie (dtLoader);
viser._visible = 0;
}
[F8] Input Textfield Inside A Dynamic Textfield?
Hi,
Is it possible to place an input textfield inside a dynamic textfield?
I'd like to replace the variable, this.nTotal, below with an input textfield.
Is there some way to do this?
this.txtComplete.text = "There are " + this.nTotal + " pages in " + this.sGirlName + "'s book.";
Thanks!
Positioning The Text Based On TextField Height
Hi All,
I wanted to position the TextField based on the height of the text in the text field. Not able to figure where I am doing wrong. The Y position does not leave 25 pixels after the last line of text. Textfield1 and Textfield2 kind of overlap.
_totalDistractors = 4
for(var i:int = 0; i < _totalDistractors ; i++) {
var taradioButtoni:TextArea = new TextArea();
taradioButtoni.text = answerChoices[i]; // Text Comes from array
taradioButtoni.width = 380;
taradioButtoni.height = taradioButtoni.textHeight + 10;
taradioButtoni.y = i*(taradioButtoni.height + 25);// Need to refine this line of code
taradioButtoni.wordWrap= true ;
}
Is It Possible To Dynamically Set The Height Of A Textfield According To Text Amount?
is it possible to dynamically set the height of a textfield according to the amount of text that's been externally loaded?
say if I only have a line of text to load in to a textfield, then that textfield could adjust is height to only the height of a line of text.
and if it is a paragraph, then the textfield will load the text with lenthened height.
is it possible to achieve that? to have a text field adjust its height according to amount of text loaded?
INPUT TextField Within An HTML TextField Via <img>
I'm trying to extend an HTML TextField to include an INPUT TextField control as an <img> tag. This I can do. The problem is that mouse and keyboard events are not being seen by the inner TextField. I created a test case to demonstrate the situation. My guess is that <img> tags are treated like AS2 events and because the outer TextField is trapping text events, they are not propagated to the inner TextField. Is there anyway around this problem? Mouse events to other DisplayObjects work fine. I'm using Flash CS3.
The test case contains two classes. TextImgTest is the document class for TextImgTest.fla. TestImg implements the <img> loaded by TestImgTest. To run this. Just create an empty TextImgTest.fla and set the document class to TextImgTest. Then publish and run.
Attach Code
package
{
import flash.display.MovieClip;
import flash.events.TimerEvent;
import flash.text.TextFieldAutoSize;
import flash.text.TextField;
import flash.text.StyleSheet;
import flash.utils.Timer;
import TestImg;
public class TextImgTest extends MovieClip
{
public var textField: TextField;
public var styleSheet: StyleSheet;
public var img: TestImg;
public var timer: Timer;
public function TextImgTest(): void
{
// render directly
img = new TestImg();
addChild(img);
// render within a TextField as an <img> tag.
styleSheet = new StyleSheet();
styleSheet.setStyle("p", {fontFamily:"sans-serif", fontSize:"10"});
textField = new TextField();
textField.styleSheet = styleSheet;
textField.multiline = true;
textField.autoSize = TextFieldAutoSize.LEFT;
textField.wordWrap = true;
textField.border = true;
textField.borderColor = 0x0000FF;
textField.background = true;
textField.backgroundColor = 0xFFCCFF;
textField.width = 190;
textField.x = 5;
textField.y = 120;
textField.htmlText = "<p>TextField with an <img src='TestMsg' id='rmk'> tag:<br><img src='TestImg' id='rmk'></p>"
addChild(textField);
textField.selectable = true;
textField.mouseEnabled = true;
// Give it a little time to render then get a reference to it.
timer = new Timer(3000, 1);
timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimeout);
timer.start();
}
public function onTimeout(evt: TimerEvent): void
{
var freeText: TestImg = textField.getImageReference("rmk") as TestImg;
freeText.tField.mouseEnabled = true;
freeText.tField.selectable = true;
freeText.tField.appendText(" Got ImageReference for 'rmk'.");
}
}
}
===================================================
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.Sprite;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TestImg extends MovieClip
{
static public const MSG_WIDTH: int = 170;
static public const MSG_HEIGHT: int = 100;
static public const MSG_MARGIN: int = 8;
public var tFmt: TextFormat;
public var tField: TextField;
public var sBut: SimpleButton;
public function TestImg(): void
{
super();
this.tabEnabled = false;
this.mouseEnabled = false;
// Show this MovieClip
with (this.graphics)
{
clear();
beginFill(0x9999FF);
drawRect(0, 0, MSG_WIDTH, MSG_HEIGHT);
endFill();
}
// Show the INPUT TextField within it.
tFmt = new TextFormat("_sans", 10, 0x000000, true, false,
false, null, null,
TextFormatAlign.LEFT);
tField = new TextField();
tField.type = TextFieldType.INPUT;
tField.height = MSG_HEIGHT - 2*MSG_MARGIN - 16;
tField.defaultTextFormat = tFmt;
tField.multiline = true;
tField.wordWrap = true;
tField.width = MSG_WIDTH - 2*MSG_MARGIN;
tField.border = true;
tField.borderColor = 0xFF0000;
tField.background = true;
tField.backgroundColor = 0xFFEECC;
tField.x = MSG_MARGIN;
tField.y = MSG_MARGIN;
tField.text = "TestImg MovieClip containing an INPUT TextField.";
this.addChild(tField);
tField.selectable = true;
tField.mouseEnabled = true;
// Show the button within this MovieClip
var butGraphics1: Sprite = new Sprite();
with (butGraphics1.graphics)
{
lineStyle(1, 0x000000);
beginFill(0xFF0000);
drawRect(0, 0, 32, 16);
endFill();
}
var butGraphics2: Sprite = new Sprite();
with (butGraphics2.graphics)
{
lineStyle(1, 0x000000);
beginFill(0x00FF00);
drawRect(0, 0, 32, 16);
endFill();
}
sBut = new SimpleButton();
sBut.upState = butGraphics1;
sBut.overState = butGraphics2;
sBut.downState = butGraphics1;
sBut.hitTestState = butGraphics2;
sBut.x = MSG_MARGIN;
sBut.y = MSG_HEIGHT - MSG_MARGIN - 16;
this.addChild(sBut);
}
}
}
Selecting Text In An Input Textfield
here's what I have...
I've got a textfield that when a user types in a letter it displays a list of items starting with the letter and keeps going as they type or until they pick one from the list.
here's the trouble...
when the text is backspaced it goes great and takes away the previous search but when it is highlighted with the mouse and changed the previous ones and the new show up.
does anyone understand this, have it happen before or need more to go on?
Input Textfield Cropping Text...
I have an input text box in a registration form...
...as i type into the input text box all is fine up until 19 characters are entered, when teh 20th character goes in all the text is suddenly cropping a couple of points from the top of the tallest characters - so t, l, h etc lose their tops!
Has anyone encountered this before? Any ideas how to fix this? I've never seen it so don't really know what's happening.
All the boxes it's happening in are defined as single line text and have html formatting disabled (i've tried enabling and it makes no difference).
Label Text In Input Textfield Box
Hi,
I am creating a contact form and I want my input textfield to have for example (First Name) in the box when the form pops up, but then when the user types in the box "First Name" disappears and then they can type their name in the input textfield. Now when I run my flash file the level and instance name shows up in the input textfield. Help please. thanks!
Input TextField : Disappearing Text
Check this out:
http://starcam.com/camraw
Use Safari or Firefox - IE is not an issue.
Try entering text in the username/password field a few times.
You will probably notice that on a pretty regular basis the text will disappear as you type.
Has anyone else seen this...and can anyone confirm what I am seeing?
Note: I have found that this problems shows up more often if you select the input textfield and type something - then select all text you just typed and delete using backspace. Once you delete the text...start typing again...you should see it.
Prewriten Text In Input Textfield That Disapper..?
Hi !
Guees it´s possible but im not sure. I got a input textfield in where I want some prewriten word as "Your email" and when you click your cursor in the textfield, the prewriten text disappear and you can start writing...!
Jakob
Detect If Text Is Selected In A Input Textfield
Hi,
I want to do a newspublishing tool and was thinking of making a simple WYSIWYG editor. User types text in a textfield, then user select the words to be bolded, press the bold-button and the textfield updates with the selected text bolded..
For starters I want to know if it's possible to detect if text is selected in a input textfield? And if somebody can point to further tutorials or reference Im most grateful.
regards /xaphod, sweden, using MX 2004
Input Textfield To---) HTML-formatted Text
I know about how you can load HTML formatted text in a Dynamic Textfield, like this. Thats easy, like this:
Code:
textField.htmlText = "<p align='left'>This uses single quotes</p>"
BUT what i want to know, if i have a "multiline input textfield", and i type some text with and skip lines with ENTER. How do i get the <br></br> tags in that typed text ???.
Does anyone have a clue?
Thanx allready
Extremefun1
Input Textfield (w/dissapearing Pre-filled Text)?
Can this be done easily?
Basically I want an input textfield that is pre-filled with some text. I want this pre-filled text to dissapear when the input textfield recieves focus (and if possible re-appear if the text field losses focus without having any text entered in to it).
Right now I'm thinking of having the pre-filled text inside a MC that sits on top of the input textfield and dissapears on mouse over, and re-appears on mouse out after checking if there is any text in the textfield. I was just wondering if there was a cleaner way of doing this?
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' />
How To Input Text Without Input Textfield
hi,
does anyone know, how i can display user input text without a textinput field ?
what i'm trying to achive is a message that is displayed on screen like in multiplayer games:
you press "t" for talk, and you see what you write in a kind of console but without changing to a text field
thanks
Defining Input Text Format And Disable Key Press On Textfield
Hi
i'm have a input form, where the users put their data like birth dates, phone numbers, and messagens.
But I need to especify if the inputs to number only, text online.
Also, the message field, should not allow the user to use brake lines pressing ENTER. Is it possibel to disabel this?
Thanks
Setting The Background Color Of The Selection When Text Selected (input TextField)
My input TextField has a black background. The problem is, when some text is enter and then selected, the selection background color remains black and the selected text remains white. Because of this it's imposible to tell that the text has been selected. Is there a way to change the selection background color, or do I really have to write a custom textfield? :(
Set Height Of Mc Same As Textfield
Hi all,
I'm working on a dynamic menu that automaticly generate the items and is easy to customize.
Now i've got a little problem and i don't see why it won't work?!
This is my code:
Code:
//Stylesheet
css_button = new TextFormat();
css_button.bold = bold;
css_button.font = "Cottingley";
css_button.size = 12;
css_button.color = "0xFF0000";
//menu items
total = 7;
text1 = "Werken bij United Restart";
text2 = "Persberichten";
text3 = "Aanvraag financieel jaarverslag USG";
text4 = "United Service Group";
text5 = "Plaatsings-percentage en doorlooptijden";
text6 = "Downloads";
text7 = "Privacy regelement";
stop();
//initialize main menu
for (i=1; i<=_root.total; ++i) {
//duplicate movie clip
menuMC.duplicateMovieClip("menuMC"+i, i);
//create a dynamic textfield
this["menuMC"+i].createTextField("txtf", 1, 15, 0, 128, 19.6);
//Add stylesheet to button texts
this["menuMC"+i].txtf.setNewTextFormat (_root.css_button);
this["menuMC"+i].txtf.text = eval("_root.text" + i);
//Textfield specs
this["menuMC"+i].txtf.autoSize = true;
this["menuMC"+i].txtf.wordWrap = true;
this["menuMC"+i].txtf.multiline = true;
//Change Depths so hitarea is on top of the generated textField
this["menuMC"+i].hitarea.swapDepths(2);
//set Height Menu items same as height of the item's texts
this["menuMC"+i].bg_button._height = this["menuMC"+i].txtf._height;
//set Height hitarea same as height of the item's texts
this["menuMC"+i].hitarea._height = this["menuMC"+i].txtf._height;
//set new position
this["menuMC"+i]._y = this["menuMC"+(i-1)]._y + this["menuMC"+(i-1)]._height+2;
this["menuMC"+i].choice = i;
}
The bold part is what is causing me a headache. I want to set the height of the hitarea (like i did with the background of the menu items) the same as the textfield height, but somehow this doen't work?!?
I've traced it and then the output gives just all 0's (zero's).
Anybody can help me out here, because i've no idea why this is causing a problem.
Thanx in advance!
Textfield Height With Xml
Hi,
I am trying to create a Textfield, pulling the height out of an xml file:
Code:
System.useCodepage =true;
var me = this;
var my_config = new XML();
my_config.ignoreWhite = true;
my_config.onLoad = function(success) {
if (success) {
trace("data loaded");
var outputHeight:Number = this.firstChild.childNodes[0].childNodes;
trace(outputHeight);//traces 292
me.createTextField("output", 1, 7, 31, 402, outputHeight);
output.multiline = true;
output.type = "dynamic";
output.border = true;
output.borderColor = 0xFFFFFF;
output.background = true;
output.backgroundColor = 0xFFFFFF;
output.selectable = false;
output.setNewTextFormat(my_fmt1);
}
};
my_config.load("config.xml");
XML:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<config>
<outputveld><292</outputveld>
</config>
or:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<config>
<outputveld><![CDATA[292]]></outputveld>
</config>
but the height of the Textfield stays zero when I compile.
How come??
Thanks,
Jerryj.
Can't Get TextField Height...
Yes, I know... try textHeight... that didn't work either. I just keep getting one line worth of height. It's not registering the wordWrap as part of the height. I even tried putting a delay in it (in the hopes that a compute cycle hadn't caught up)... no luck.
Here is what the trace in the code yields:
97
112
112
Here's the code:
Attach Code
function popText(panelID){
//if moving the panels into place is done, draw the content...
if (mainPanel[panelID].isTweening() == false){
clearInterval(popPanText[panelID]);
var TextVar = "mainPanelText[" + panelID + "]";
var captVar = "mainPanelCaption[" + panelID + "]";
var headVar = "mainPanelHeader[" + i + "]";
//movie clip to contain all the text
mainPanelText[panelID] = mainPanel[panelID].createEmptyMovieClip(TextVar, mainPanel[panelID].getNextHighestDepth());
//set up the header
mainPanelHeader[panelID] = mainPanelText[panelID].createTextField(headVar, mainPanelText[panelID].getNextHighestDepth(), 10,0, 280, 0);
mainPanelHeader[panelID].multiline = true;
mainPanelHeader[panelID].wordWrap = true;
mainPanelHeader[panelID].autoSize = "left";
mainPanelHeader[panelID].text = panelHeader[panelID];
mainPanelHeader[panelID].setTextFormat(PanelHeaderStyle);
//set up the caption
mainPanelCaption[panelID] = mainPanelText[panelID].createTextField(captVar, mainPanelText[panelID].getNextHighestDepth(), 10, 0, 280, 0);
mainPanelCaption[panelID].html = true;
mainPanelCaption[panelID].wordWrap = true;
mainPanelCaption[panelID].multiline = true;
mainPanelCaption[panelID].autoSize = "left";
mainPanelCaption[panelID].htmlText = panelIntro[panelID];
mainPanelCaption[panelID].setTextFormat(PanelCaptionStyle);
//lower the caption under the header.
mainPanelCaption[panelID]._y = mainPanelHeader[panelID]._height;
trace(mainPanelText[panelID]._height);
//mainPanelCaption[panelID]._y = 320 - mainPanelCaption[panelID]._height;
//mainPanelHeader[panelID]._y = mainPanelCaption[panelID]._y - mainPanelHeader[panelID]._height;
}
}
[AS3] TextField Height
How do I predict the TextField height? When I initiate one, it comes with 100 height, but I want to set it to the fonts height.
I have tried the autoSize, but some times it shrinks the text field to a very tiny one, and some times it stays at fonts height, but I can't set its width anymore...
Is there a solution to this problem?
Thanks,
Ian Liu.
[AS] Textfield Height Bug?
I just ran into a problem with textfields and MX2k4. Has anyone noticed that the actual height of a standard, wordwrapped text field does not give the same height if you do a trace(myTXT._height)
For example take a look at this file:
temp.fla
Notice the actual height value then preview the fla. The trace will give a completely different number. 600 vs 675.
Normally this wouldnt be a problem but my scrollbar script uses the height of the textfield to calculate how much to scroll. Since the number is incorrect so is the scrolling. This can be fixed by breaking apart my textfield, but that makes updating the text a real pain.
Is there a way to get the actual value of the textfield height without using the myTXT._height? (I also used the myTXT.textHeight command, but it only works for dynamic text not static)
Any help would be greatly appreciated.
Thanks!
Textfield Height ?
Hi everybody...
Allright, i load text from a external txt file in a textfield.
I use the ' maxscroll ' function to give the number of line text there is now in my textfield.
My questions to everybody is:
can you resize a textfield (height) depending on the number of line of text that it contain.
exemple:
3 lines of text = 30 pixel
10 lines of text = 100 pixels
Thanx
Height Of A Textfield
I'm loading some text from a database into a textfield. I would like to know how I can attach a mc directly under that text.. The thing is the random text loaded is between 2 and 10 rows.
Another thing I also need help with is how to get the last value of an array. I couldn't get it to work...
Thanks!
Dynamic Textfield Height
i have a dynamic textfield which is to load a pretty long text file. however, this dynamic textfield height appears to be not long enough for it to show the full length of the text file. is there a way where the height of the dynamic textfield will increase itself when the length of the textfield is long? this is because once i reaches 3000height, i cant increase during design time anymore as i will get an error saying invalid height.
thanks
Getting Height Of Dynamic Textfield
A rather simple problem.
The main MC duplicates the container MC which has a dynamic textfield. Each one of the container MCs must be placed under the previous one with 20px distance. The problem is that the variable of the main MC which should calculate (getProperty) the final height of the dynamic textfield is not working.
Help Me Figure Out The Height Of The TextField Please
I'm going crazy here! Can't figure out why it won't give me the height of the textField that I dynamically create.
Code:
var my_fmt:TextFormat = new TextFormat();
my_fmt.font = "Arial";
my_fmt.color = 0x000000;
my_fmt.size= 11;
my_fmt.bold = false
temp2=this._parent.getNextHighestDepth();
this._parent.createTextField("the_text", temp2, tempx+5, tempy-8, 192, undefined);
this._parent.the_text.multiline = true;
this._parent.the_text.html = false;
this._parent.the_text.wordWrap = true;
this._parent.the_text.text=this.description;
this._parent.the_text.setTextFormat(my_fmt);
this._parent.the_text.autoSize = true;
box_height=this._parent.the_text._height;
trace(box_height);
Can anyone see what's wrong?
Height Of Dynamic Textfield?
Hey everyone
Very simple: I have a dynamic textfield inside a MC. This MC is duplicated below eachother, like any other news-pages. I have to check the height of the dynamic movieclip to know where the next clip has to be, but when reading the height, it reads the height before the text is loaded inside the clip...
I have read something about this before, but I can't figure out how to make it work...
Please :-)
[F8] Can't Adjust Textfield Height
I have a dynamic text field that I want to change the height. I use text._height = new_height. But trace of the _height is a totally different number. Why is that? I have spent hours trying to make it work. I really need some help:-(
Here is the sample project.
http://www.gotomyhome.com/temp/test.fla
Thanks
Dynamic Textfield Height
Hey everyone
I have this problem again, again. I Have a loop, where I attach several movieclips to the stage, load som xml text into them, and position them under eachother according to the previous clips height.
The problem is, that the height I'm getting is the height of the movieclip BEFORE the text has loaded into it - and not the actual height that I want. This is offcourse because the text takes a little time to pe put into the clip (I have preloaded the XML, so the xml loading is not an issue).
How can I solve this?
This is my code:
Code:
/******************************************************
FIND LIVE IN XML AND PUT IN ARRAY
******************************************************/
// Make array with all XML inside root-tag
var nodes:Array = _root.xml.firstChild.childNodes;
// Loop through them
for(i=0;i < nodes.length; i++)
{
// If we have the news tag
if(nodes[i].nodeName == 'news')
{
// Put all childnodes into new array
var newsNodes:Array = nodes[i].childNodes;
}
}
/******************************************************
DUPLICATE NEWSCLIP AND PUT TEXT INTO
******************************************************/
var currY:Number = 0;
// loop through all the news
for(i=0; i<newsNodes.length; i++)
{
// Create empty MovieClip
var holder:MovieClip = textclip.createEmptyMovieClip("newsholder"+i, textclip.getNextHighestDepth());
// Attach newsclip to the new movieclip
var s:MovieClip = holder.attachMovie("newsclip", "newsclip"+i, textclip.getNextHighestDepth());
// Put text into
s.overskrift.text = newsNodes[i].attributes.overskrift;
s.date.text = newsNodes[i].attributes.date;
s.tekst.text = newsNodes[i].firstChild.firstChild.nodeValue;
// Set X & Y for the movieclip
s._x = 0;
s._y = currY;
// update variable with the Y for the next clip + distance between
currY += s._height + 5;
}
TextField AutoSize And Height
A bit perplexed about something...
I'd like to have a fixed-width, multiline textfield, but one where the height auto-adjusts.
i.e. - in the example below, where forceWidth is a Number vs. null, the TextField has the default height of a newly created TextField, rather than the else statement, where the TextField's height is the same as its content.
I want the height of the TextField to always be that of the content.
Code:
var label:TextField = new TextField();
label.background = true;
label.border = true;
if (forceWidth) {
label.width = forceWidth;
label.wordWrap = true;
} else {
label.autoSize = TextFieldAutoSize.LEFT;
}
label.defaultTextFormat = format;
label.text = txt;
Textfield Height Limit?
I am working a project that require me to pull large amounts of text onto stage and make it scrollable. So I have, but I have encountered a problem in 3 different files that when the textfield's height is more than about 1400, 1500 pixels it starts to cut off text.
I checked to see if it's a character limit and it's not that. I've made the scroller myself but I can't see how that is causing the problem. It works for all my other fields.
Is there a bug within flash, or maybe CS3? I'm working in AS2 in CS3.
Any help or insight on this problem would be much appreciated.
Can't Adjust Textfield Height
I have a dynamic text field that I want to change the height. I use text._height = new_height. But trace of the _height is a totally different number. Why is that? I have spent hours trying to make it work. I really need some help:-(
Here is the sample project.
http://www.gotomyhome.com/temp/test.fla
Thanks
Get Dynamic Textfield Height?
How do i get the height of a dynamic textfield? I need this to place the textfield relative from the bottom.
ActionScript Code:
//footer mcvar footer_mc:MovieClipvar footer:TextField;var contentWebWidth = contentWeb._width;var footerWidth:Number = contentWebWidth -50;var offSet:Number = (contentWebWidth - footerWidth) /2;var footerX:Number = -(contentWebWidth /2) + offSet ;var footerHeight = (contentWeb.footer_mc.footer._height);var footerY:Number = (contentWeb._height /2) - footerHeight;contentWeb.footer_mc.footer._width = footerWidth ;contentWeb.footer_mc.footer.wordWrap = true;contentWeb.footer_mc.footer.multiline = true;contentWeb.footer_mc.footer.autoSize = true;contentWeb.footer_mc._x = footerX;contentWeb.footer_mc._y = footerY;trace ("Height: "+footerHeight);
My footer textfield is multiline but it doesn't give me the corresponding textfield height??
Any tips?
TextField Line Height
Hi guys.
Is there anyway to get the font line height of a TextField? I can't find anything in the Flash Help docs but I may have missed something.
Cheers.
Si ++
TextField Height - Transform
Hi,
I have a textfield thats created on a canvas mc (createTextField). If i after that set the height and width of the canvas AND the textfield to say 200 they get totalt different size ... The textfields becomes much smaller. SHouldn't they both be 200 wide and high? What i'm i missing? Do the have different reference points or something? I've tried localTpGlobal a bit but that haven't helped me.
I'd love som help.
Thanks
Richard
TextField Height Not Available Initially
Hello all,
Lets say I have a dynamic text field with autoSize = true on it. and I have a MovieClip behind it that I want to be the same size as the text field.
If I fill the text field with 10 lines or whatever of text, then try and do something like myMovieClip._mc._height = myTextField._height; it will never work....it always displays the initial height of the text field (22 in this case)...I guess because it has not been drawn yet. Is there any way around this?
Cheers,
E
How To Restrict Height On A Dynamic Textfield
I have a textfield with autoSize = true;
I load text into it using XML and want to restrict the amount of content it can load in so it does scale out of a certain height
Any ideas how I can do this?
Dynamic Textfield-height And Content
I'm working on a webiste, and I'm creating textboxes with scrollbars. To make the scrollbars, I need to determine the height of the textfield I create. The textfields will load in text from a variable, so how do I now what height to set on the dynamic textfields.
thanks
The Height Of A Dynamically Created Textfield
Hi, hello and everything else...
If I'd have a variable with some html-text and I'd want to put it into a textfield created by actionscript, how can I find out what the height of the textfield should be?
I was thinking of roughly counting the text with a for-loop, like increasing some variable a lot when a "<br>" is detected and ignoring other brackets and stuff, but I figured there might be an easier way to achieve this...right??
Thanks for all your time - Ruben
|