Skip to main content
Participant
August 14, 2006
Question

TextField Help!

  • August 14, 2006
  • 1 reply
  • 303 views
Hey,
I'm still new to action script in Flash 8. I want to be able to add a paragraph of text to an empty text field via action script. Heres what I'm typing in the action panel. News_txt is the instance name on the stage.

this.Recent_mc.onPress = function() {
News_txt.text = "This is the text I am typing to show in the SWF and
its not working. I really want this to work. Blah blah blah blah. I'm
just filling up space";
}

Heres what the output panel says...

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 26: String literal was not properly terminated
News_txt.text = "This is the text I am typing to show in the SWF and

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 27: Syntax error.
its not working. I really want this to work. Blah blah blah blah. I'm

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 28: Syntax error.
just filling up space";

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 29: Syntax error.
}

Total ActionScript Errors: 4 Reported Errors: 4

How do I fix this? How do I make it so that when I type text in the action script panel it doesnt carry all the way across the screen out of view? I want to be able to type it in the panel like I was typing it as a normal paragraph. Any help is appreciated. Thanks guys.

Dan
This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 14, 2006
don't use the enter key in your string. if you want to indicate a new line (or carriage return) for the textfield use \n (or \r ).
Participant
August 14, 2006
Hey thanks for the response. I still can't get it to work though. I tried the style sheet method and its not working either. Do you mind repasting the actionscript I put here with corrections?

var ourStylesheet = new TextField.StyleSheet();
ourStylesheet.setStyle("p", {fontFamily:'_sans', fontSize:'12 px', color:'#000000'});
newsTextArea.styleSheet = ourStyleSheet;
newsTextArea.html = true;


Recent_mc.onPress = function() {
newsTextArea.text = "<p> what happens when the viewer is placed into a
movie title? An interesting example of Flash/Freehand connection.</p>";
};




output = **Error** Scene=Scene 1, layer=Actions, frame=1:Line 32: String literal was not properly terminated
newsTextArea.text = "<p> what happens when the viewer is placed into a </n>

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 33: Syntax error.
movie title? An interesting example of Flash/Freehand connection.</p>";

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 31: Statement block must be terminated by '}'
Recent_mc.onPress = function() {

**Error** Scene=Scene 1, layer=Actions, frame=1:Line 35: Syntax error.

Total ActionScript Errors: 4 Reported Errors: 4


kglad
Community Expert
Community Expert
August 14, 2006
it looks like you still are using an enter key after "into a". copy and paste either of the two codes below: