Click to See Complete Forum and Search --> : Flash Dynamic Text Problem


ctopherg
04-09-2007, 03:49 PM
http://chris.mustangtest.com/maxbennys/

Above is an example of my problem. I have 5 dynamic text fields. Each one pulls information from a mysql database. The length of the text fields vary depending on the amount of text in the database. The amount of text will change often. My problem:
When the text is pulled from the database to fill in the text field. The text fields overlap each other. I need some help in not letting them overlap. I need the text field to start at the end of the previous text field.
Any suggestions will be appreciated.

Script so the text fills the text field:

text1.autoSize = true;
text1.multiline = true;
text1.wordWrap = true;

ryanbutler
04-09-2007, 04:28 PM
It's hard to tell from that demo what a possible solution could be. Do you have a real-working example?

ctopherg
04-09-2007, 05:18 PM
that is the working example I have right now. I basically want an admin panel so that a user can update the text in a mysql database easily and the flash file updates by the info posted to the database.

http://maxandbennys.com/

Right now, you will see the flash file with the text. But everytime it needs updating you have to open the fla. I want anyone with admin access to type some text on a php page, click submit and the database is updated. I got all that working so far. And the swf does display the information, just the text fields are different sizes and I want to get rid of the overlap. So I need to find a way to define the height of the text fields according to the amount of text in the box and place the next text field underneath when the text above stops.

discorax
04-12-2007, 05:37 PM
You can use the myTextField._height property to determin the height of the textField and then place the next textfield below that one.

Does that make sense?

Since I'm not familiar with the process you're using to create these text fields I can't go more in depth.


var TextFieldHeight:Number;
var spaceBetweenTextFields:Number = 10;
function makeTextField():Void{
this.createTextField("mytext",1,100,100,300,100);
mytext._y = determinYPos;
mytext.autoSize = true;
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = false;

myformat = new TextFormat();
myformat.color = 0xff0000;
myformat.bullet = false;
myformat.underline = true;

mytext.text = "GET THIS FROM THE DATABASE";
mytext.setTextFormat(myformat);
}

function determinYPos():Number{
//get the height of the previous TextField
TextFieldHeight = mytextfield._height + mytextfield._y + spaceBetweenTextFields;
//and then pass that value back to the function
return TextFieldHeight ;
}



This code does not work...I just wanted to give you an idea of how you could approach this problem. If I have some more time I'll see if I can get something that actually works for you.

discorax
04-12-2007, 06:21 PM
Ignor the above post...The following code works.


var TextFieldHeight:Number;
var spaceBetweenTextFields:Number = 10;
var Stuff:Array = new Array("Hello there!", "This is where I'm going to be putting all my text stuff.","All of this text is created to be used as an example.","I guess I could have just used some Greeking, but alas I'm almost done making this stuff.", "Weeeeeee!");

var __Y:Number = 50;
var __HEIGHT:Number;
for (i:Number = 0; i<Stuff.length; i++){
this.createTextField("mytext"+i,this.getNextHighestDepth(),50,0,100,100);
__HEIGHT = determinYPos(this);
this["mytext"+i]._y = __HEIGHT;
this["mytext"+i].autoSize = true;
this["mytext"+i].multiline = true;
this["mytext"+i].wordWrap = true;
this["mytext"+i].border = false;

myformat = new TextFormat();
myformat.color = 0x000000;

this["mytext"+i].text = Stuff[i];
this["mytext"+i].setTextFormat(myformat);

}
function determinYPos(mc:MovieClip):Number{
//get the height of the previous TextField
__HEIGHT = mc._height + mc._y + spaceBetweenTextFields;
//and then pass that value back to the function
return __HEIGHT ;
}


You can see an example here (http://www.pbjs.com/rcd/textField/)