• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

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...
0
Walkem5
Asked:
Walkem5
  • 5
1 Solution
 
BillystyxCommented:
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
0
 
Walkem5Author Commented:
Uumm..I'm still not understanding....Is there anyway you can put this in a working example?

Thanks,
Walkem5
0
 
BillystyxCommented:
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:)


0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
BillystyxCommented:
sorry ,mistakes on lastone_using a separate textfile as in above post, do this:
frame1:
loadVariables("myText.txt","","GET");
frame2:
if(myText!="undefined" && myText.length>0){
      gotoAndStop(4);
}
frame3:
gotoAndPlay(2);
frame4:
var myformatname = new TextFormat();
     with (myformatname) {
          font = "Tahoma";
          bold = true;
          color = 0x999999;
         
     }

createEmptyMovieClip("clip", i);
          dep = _root.getNextHighestDepth();
          clip.createTextField(["Text1"], dep, 0, 0, 300, 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.myText;//loaded variable name

this.clip.Text1.setTextFormat(myformatname);
stop();

billystyx
0
 
BillystyxCommented:
Did this help you?

Billystyx
0
 
BillystyxCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now