[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Creating and loading a text field

Posted on 2005-04-21
6
Medium Priority
?
178 Views
Last Modified: 2010-04-03
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
Comment
Question by:Walkem5
  • 5
6 Comments
 
LVL 18

Expert Comment

by:Billystyx
ID: 13840577
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
 

Author Comment

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

Thanks,
Walkem5
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13865587
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Accepted Solution

by:
Billystyx earned 2000 total points
ID: 13866039
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
 
LVL 18

Expert Comment

by:Billystyx
ID: 13907653
Did this help you?

Billystyx
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13966552
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question