Link to home
Start Free TrialLog in
Avatar of Walkem5
Walkem5

asked on

Creating and loading a text field

Hi All,

I am looking for steps on how to create a text field that loads and displays like the ones on www.foreverbrandy.com ... you might have to click on some of the different buttons to get the full effect of how they load (click the life button and then click on bio, journal, etc.)  I would also like to incorporate the scroll bar into things so that the text field is already scrollable and I can enter as much information into an external text file as I wish and be able to change things on the fly in the future without worrying about if all the content will fit into the text box. How would I go about doing something like this?

I am sorta a newbie to flash... So steps/code with comments are definately needed.

Thanks in advanced...
Avatar of Billystyx
Billystyx

var myformatname = new TextFormat();
      with (myformatname) {
            font = "Tahoma";
            bold = true;
            color = 0x999999;
            bullet = true;
      }
for (i=num; i<nro; i++) {
this.createEmptyMovieClip("clip", i);
            dep = this.clip.getNextHighestDepth();
            this.clip.createTextField(["Text"+i], dep, 0, 0, 60, 30);
            this.clip["Text"+i].multiline = false;
            this.clip["Text"+i].wordWrap = true;
            this.clip["Text"+i].border = true;
            this.clip["Text"+i].background = true;
            this.clip["Text"+i].backgroundColor = 0x666666;;
            this.clip["Text"+i].borderColor = 0x666666;;
            this.clip["Text"+i].text = _root["myVar"+i];//loaded variable name
}
this.clip["Text1"+i].setTextFormat(myformatname);


this will add a textfield with some formatting - you can just essentially change the text value, or make sure that there is a variable n the root with the name myVar1, for example.
nro is the number of rows pulled from your serverside scripting (from a db for example).
Make sure you pass that to flash at the same time as multilpe variables, so you know how many rows of info you should process. O/w if there is only 1 set of variables you can do away wit the for statement, and hardcode your clip names.
Does this help?
Billystyx
Avatar of Walkem5

ASKER

Uumm..I'm still not understanding....Is there anyway you can put this in a working example?

Thanks,
Walkem5
try this first:
frame1:
myVar="some text";//mkae this as long as you want and it should scroll
var myformatname = new TextFormat();
     with (myformatname) {
          font = "Tahoma";
          bold = true;
          color = 0x999999;
          bullet = true;
     }

createEmptyMovieClip("clip", i);
          dep = _root.getNextHighestDepth();
          clip.createTextField(["Text1"], dep, 0, 0, 60, 30);
         clip.Text1.multiline = true;
          clip.Text1.wordWrap = true;
          clip.Text1.border = true;
          clip.Text1.background = true;
          clip.Text1.backgroundColor = 0x666666;;
          clip.Text1.borderColor = 0x666666;;
          clip.Text1.text = _root.myVar;//loaded variable name
}
this.clip.Text1.setTextFormat(myformatname);

then push ctl-enter and test it - the text should appear in your dynamically created textfield.
toload from outside, make a text file like this:
myVar=some text
and save in same folder as myText.txt
then, before the text creation script, (in frame1 at the top) put:
loadVariables("myText.txt","","GET");

Billystyx

ask me about the elements of this you are unsure of:)


ASKER CERTIFIED SOLUTION
Avatar of Billystyx
Billystyx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did this help you?

Billystyx
Are you there?
If this has helped can you close the question? O/W let us know what you can't figure out (certain bits/everything) and I will try to explain.

Billystyx