all groups > flash data integration > april 2007 >
You're in the

flash data integration

group:

expanding dynamic text box


expanding dynamic text box Jeff3d
4/12/2007 4:31:52 PM
flash data integration:
I have a scroll pane that is linked to a movie clip with a dynamic text field.
The scroll pane expands automatically based on the length of the dynamic text
field. I would also like to have the dynamic text field expand automatically to
fit the dynamic content from an external .txt file if there is too much text to
fit in the default text field length.

Here is the code I am using to get the .txt files:

myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
// the data is loaded in the myLoadVars object as a property of the object
myText.htmlText = myLoadVars.myHTMLdata;
}
myLoadVars.load("MCAS-EMST/Body-1.txt");

Thank you for your help
Re: expanding dynamic text box MotionMaker
4/13/2007 12:00:00 AM
Re: expanding dynamic text box Jeff3d
4/13/2007 3:03:53 PM
Thank you, but I am trying to set up an existing dynamic text field that is
displayed through a scroll pane.
How do you apply

myText.autoSize = True;

to an existing dynamic text field so the loaded text raps and the text field
automatically expands down to accomodate the loaded text and the scroll pane
recognizes that the linked text field has expanded.
The first frame action of the dynamic text field movie clip already has the
following script to load the .txt file:

myLoadVars = new LoadVars();
myLoadVars.onLoad = function() {
// the data is loaded in the myLoadVars object as a property of the object
myText.htmlText = myLoadVars.myHTMLdata;
}
myLoadVars.load("MCAS-EMST/Body-1.txt");

Thank you
Re: expanding dynamic text box MotionMaker
4/13/2007 6:07:27 PM
Thus you set the width parameter for the TextField and turn on word wrap like
this:


var myHtml_txt:TextField = this.createTextField("myHtml_txt", 1, 0,0,100,0);
myHtml_txt.autoSize = true;
myHtml_txt.multiline = true;
myHtml_txtwordWrap = true;
myHtml_txt.border = true;
myHtml_txt.html = true;
myHtml_txt.htmlText = "First line of text first sentence. First line of text
second sentence. ";
myHtml_txt.htmlText += "Second line of text first sentence. ";
myHtml_txt.htmlText += "Third line of text first sentence. ";
AddThis Social Bookmark Button