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




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.



FlashKit > Flash Help > Flash ActionScript
Posted on: 05-13-2002, 02:22 PM


View Complete Forum Thread with Replies

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

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

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)

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.

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

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

[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

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 ?

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

Thanks.

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

Thanks.

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

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

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

Any ideas?
Thanking you

DM

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)

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.

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.

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.

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

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

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.

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

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

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

Limit Number Of Lines In A Textfield
Hi there!

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

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

Thanx!!

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?

Textfield Number Of Visible Lines
Hey all,

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

Thanks for any help!
Jay

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

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?

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.

[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?

Properties Of Individual Lines In Textfield?
Hi,

I'm populating a textfield with a set of variables with actionscript - one per row in the field. What I would like to do is to alternate the background color for each row, i.e. row 1=gray, row 2=red, row 3=gray and so on.

I can't seem to find any properties for individual rows/lines in the field, only for the entire textfield.

Any pointers?

Thanx for your help.
/Magnus...

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.

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.

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

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

Is there a way tro do this?

cYa

Ivo

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

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

ThanX, cYa.

Limit Total Value For Dynamic Text
Hi,

I've got two buttons: one which increases the value of a dynamic text box by 1, and one which decreases the same text by 1. I need to set a limit on the value of the dynamic text box, to -35 to +35.

The code I've got so far:

//set inital value of text box
trial1_txt.text = 0;

//control the increase button
this.Increase_btn.onPress = function(){
trial1_txt.text++;
}

//control the decrease button
this.Decrease_btn.onPress = function(){
trial1_txt,text--;
}

Any help would be greatly appreciated! I'm SOOOOO stuck on this one!

Thanks!

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!

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!

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!

Load Total Time Of .flv Into Dynamic Text Box ?BUG?
This code actually works but while the video is buffering I get "NaN" in the total time text box. Is there a way to avoid this? The code for this text box is the totalText on the second to last line. Thanks.

Code:

var nc:NetConnection = new NetConnection();
nc.connect("rtmp://flash.maddash.net/flashv/pvhs");

var ns:NetStream = new NetStream(nc);

ns.setBufferTime(10);

ns.onStatus = function(info) {
   if(info.code == "NetStream.Buffer.Full") {
      bufferClip._visible = false;
   }
   if(info.code == "NetStream.Buffer.Empty") {
      bufferClip._visible = true;
   }
}
   
theVideo.attachVideo(ns);

ns.play("pvhs_high");

againButton.onRelease = function() {
   ns.seek(0);
}

pauseButton.onRelease = function() {
   ns.pause();
}

var videoInterval = setInterval(videoStatus,100);
var amountLoaded:Number;
var vidDur:Number;

ns["onMetaData"] = function(obj) {
     vidDur = obj.duration;
}
   
function videoStatus() {
   loader.scrub._x = ns.time / vidDur * 235;
}

var scrubInterval;

function scrubit() {
   ns.seek(Math.floor((loader.scrub._x/235) * vidDur));
}

function checkTime(ns:NetStream,duration:TextField) {
    var ns_seconds:Number = ns.time;
    var minutes:Number = Math.floor(ns_seconds/60);
    var seconds = Math.floor(ns_seconds%60);
    var vidminutes:Number = Math.floor(vidDur/60);
    var vidseconds = Math.floor(vidDur%60);
    if (vidseconds<10) {
       vidseconds = "0"+vidseconds;
    }
    if (seconds<10) {
    seconds = "0"+seconds;
    }
    durText.text = minutes+":"+seconds+" / "+vidminutes+":"+vidseconds;
   totalText.text = vidminutes+":"+vidseconds;
}
var time_interval:Number = setInterval(checkTime, 60, ns,duration);

Total Visits/total Sound Plays
How can I get a "total visits"type function but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible

Total Visits/total Sound Plays
How can I get a "total visits"type function but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible

Total Visits/ Total Sounds Played
How can I get a "total visits" type function that makes the number of times a page has been visited visible, but instead of recording the number of visits, it records the number of sounds streamed from that flash movie and makes it visible. (Not pages but externally loaded and streamed sound.)

tks
ken

[AS2] Total Newb -- How To Display Array Value In Dynamic Text Box
Hey guys, Is it possible to display array values in a dynamic text box -- All created in As2? My problem is I need a dynamic text box that will load On button press, at the bottom left hand corner of images of various size. I got the positioning part down...but I cant seem to make it display what I have stored in an array -- namely 'text' from an xml attribute. is there a way to do this?
This is the text field in a movieclip. I acknowledge that the names are very dumb.

Code:
this.createEmptyMovieClip("wassup", this.getNextHighestDepth());

wassup.createEmptyMovieClip("buttonBkg", wassup.getNextHighestDepth());

wassup.buttonBkg.lineStyle(0, 0x000000, 0, true, "none", "square", "round");
wassup.buttonBkg.lineTo(120, 0);
wassup.buttonBkg.lineTo(120, 30);
wassup.buttonBkg.lineTo(0, 30);
wassup.buttonBkg.lineTo(0, 0);
wassup.buttonBkg.endFill();
wassup.buttonBkg.alpha(0);

var myFormat:TextFormat = new TextFormat();
myFormat.align = "center";
myFormat.font = "my_font";
myFormat.size = 16;
myFormat.color = 0x000000;

wassup.createTextField("closer", wassup.getNextHighestDepth(), 0, 5, wassup._width, 24);

//this is where I'm getting tripped up -- What do I point to? And where does wassup.closer.text go?
wassup.closer.text = "";
wassup.closer.embedFonts = true;
wassup.closer.selectable = false;
wassup.closer.antiAliasType = "advanced";
wassup.closer.setTextFormat(myFormat);
wassup.closer.autoSize = true;
this is the On Press function of a calendar template I got at FlashComponents. (yeah, boo me)
but really i just want to point out that the 'what' array is what I want...I 'push' it below the xml parsing. Ignore the 'area.txt' stuff as it is from the template and I'm afraid to get rid of it.


Code:
function didyoupressme(n:Number){
var currentSelected;
var movieClip:MovieClip = createEmptyMovieClip("movieClip", 0);
var where = new Array();
var what = new Array();
var linkname = new Array();
for (i=0;i<my_xml.firstChild.childNodes.length;i++){
if (my_xml.firstChild.childNodes[i].attributes.number == curentYear)
for (j=0;j<my_xml.firstChild.childNodes[i].childNodes.length;j++){
if (my_xml.firstChild.childNodes[i].childNodes[j].attributes.number== curentMonth)
for (k=0;k<my_xml.firstChild.childNodes[i].childNodes[j].childNodes.length;k++)
if (my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].attributes.number==n)
for (q=0;q<my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes.length;q++){
if ((my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt!=undefined)
and (my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.lnk!=undefined))
if (informationTextFont)
area.txt.htmlText+="<b><font color='"+informationTextLinkColor+"' size='"+informationTextSize+"'face='"+informationTextFont+"'><a href='"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.lnk+"'>"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt+"</a></font></b>";

else
area.txt.htmlText+="<font color='"+informationTextLinkColor+"' size='"+informationTextSize+"'face='"+informationTextFont+"'><a href='"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.lnk+"'>"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt+"</a></font>";
else if (my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt!=undefined)
if (informationTextBold)
area.txt.htmlText+="<b><font color='"+informationTextColor+"' size='"+informationTextSize+"' face='"+informationTextFont+"'>"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt+"</font></b>";
else
area.txt.htmlText+="<font color='"+informationTextColor+"' size='"+informationTextSize+"' face='"+informationTextFont+"'>"+my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt+"</font>";
if (my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.pic!=undefined){
ok=true;


var url = new String;
url = my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.pic;
//trace (url);
var blurb = new String;
blurb = my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.txt;
//trace (blurb);
var going = new String;
going = my_xml.firstChild.childNodes[i].childNodes[j].childNodes[k].childNodes[q].attributes.lnk;
//trace (going);
where.push(url);

what.push(blurb);
linkname.push(going);

var listenerObj:Object = new Object();
listenerObj.onLoadInit = function (target_mc:MovieClip):Void {
target_mc._x = (Stage.width / 2 - target_mc._width) / 2 + 850;
target_mc._y = (Stage.height / 2 - target_mc._height) / 2 + 175;
//trace("dimensions" +target_mc._width + target_mc._height);
var myDropShadowFilter = new DropShadowFilter (16,45,0x000000,.15,15,15,1.5,1,false,false,false);
target_mc.filters = [myDropShadowFilter];
var tw:Tween = new Tween(movieClip,"_alpha",Strong.easeIn,0,85,1,true);

myButton1._x = ((Stage.width / 2 - target_mc._width) / 2 + 850) + target_mc._width - 95;
myButton1._y = ((Stage.height / 2 - target_mc._height) / 2 + 175) + target_mc._height + 10;
wassup._x = ((Stage.width / 2 - target_mc._width) / 2 + 850) + target_mc._width - 95;
wassup._y = ((Stage.height / 2 - target_mc._height) / 2 + 175) + target_mc._height + 10;

currentSelected = "movieClip";

}

var movieClipLoader:MovieClipLoader = new MovieClipLoader();
movieClipLoader.addListener(listenerObj);
movieClipLoader.loadClip(url, movieClip);
myButton1.onRelease = function() {

getURL(going);

}
}
}
}
}
}
So basically as this stands -- I can load in the text field and position it where I want to. I stored information in an array that I can trace as valid. I just need to get that array text into the text field. Whether this is possible, or whether this is the best way -- very good questions which I can't seem to find answers to.

Please help.

Current And Number Of Total Frames In Dynamic Text
At the moment I'm making a presentation for school in Flash MX 2004. I want some kind of progression bar in the presentation. This is how I have it in my mind:

2/15

2 is the current frame and 15 is the total number of frames. I know I have to do this with the use of ActionScript in combination with dynamic text labels. How can I read out the current frame number and the total number of frames?

The names of the dynamic text labels are:

"cFrame" and "tFrames"

[AS2] Total Newb -- How To Display Array Value In Dynamic Text Box
Hey guys, Is it possible to display array values in a dynamic text box -- All created in As2? My problem is I need a dynamic text box that will load On button press, at the bottom left hand corner of images of various size. I got the positioning part down...but I cant seem to make it display what I have stored in an array -- namely 'text' from an xml attribute. is there a way to do this?

Current And Number Of Total Frames In Dynamic Text
At the moment I'm making a presentation for school in Flash MX 2004. I want some kind of progression bar in the presentation. This is how I have it in my mind:

2/15

2 is the current frame and 15 is the total number of frames. I know I have to do this with the use of ActionScript in combination with dynamic text labels. How can I read out the current frame number and the total number of frames?

The names of the dynamic text labels are:

"cFrame" and "tFrames"

How Do I Get My Elapsed/Total Time Dynamic Text Boxes Into..
How do I get my Elapsed/Total Time dynamic text boxes into a flash skin template. I put the boxes in the skin and have the code to make it work on my main stage yet it doest do anything. When i put the text boxes on the stage it works... any thoughts?

Masking Dynamic Textfield When The Textfield Has A Stylesheet
ok... i have a movieClip containing dynamic textfields, which i'm trying to mask. the textfields are linked to a stylesheet. i understand that, for the masking to work, i have to embed the font. so i've placed the font in the library, given it a linkage name and set embedFonts = true for the dynamic textfields.

what do i do next? and does the fact that i'm embeding the font override the effect of the stylesheet?

(sorry if i sound confused over this. that's because i am.)

thanks in advance for any help

[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!

Masking Dynamic Textfield When The Textfield Has A Stylesheet
ok... i have a movieClip containing dynamic textfields, which i'm trying to mask. the textfields are linked to a stylesheet. i understand that, for the masking to work, i have to embed the font. so i've placed the font in the library, given it a linkage name and set embedFonts = true for the dynamic textfields.

what do i do next? and does the fact that i'm embeding the font override the effect of the stylesheet?

(sorry if i sound confused over this. that's because i am.)

thanks in advance for any help


||| O ^ | + O ¬

Masking Dynamic Textfield When The Textfield Has A Stylesheet
ok... i have a movieClip containing dynamic textfields, which i'm trying to mask. the textfields are linked to a stylesheet. i understand that, for the masking to work, i have to embed the font. so i've placed the font in the library, given it a linkage name and set embedFonts = true for the dynamic textfields.

what do i do next? and does the fact that i'm embeding the font override the effect of the stylesheet?

(sorry if i sound confused over this. that's because i am.)

thanks in advance for any help


||| O ^ | + O ¬

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