The Printable Text
As you might have guessed, the next thing is to create the offscreen TextArea. The code for this is nearly the same as for creating the onscreen text (which is probably a good clue that in a real-world application that is not just a demonstration this would be a good time to either employ a function or an object).
Here you are going down the same path. First, create a movieclip named mc2, which will give a clear path by which to control of the TextArea.
Then create the off-screen TextArea as text2 and then do the following:
- Set the size (notably for printing on American letter-sized paper).
- Set the position slightly offscreen for now. Later you can move it completely off the stage.
// Define offScreen/printable textarea this.createEmptyMovieClip("mc2", this.getNextHighestDepth() ); mc2.createClassObject(TextArea, "text2", mc2.getNextHighestDepth()); mc2.text2.move(400, 80); // a good size for printing out on American, standard letter-sized paper mc2.text2.setSize(525, 650); mc2.text2.html = true; mc2.text2.wordWrap = true; mc2.text2.styleSheet = printStyles; mc2.text2.antiAliasType = "advanced"; mc2.text2.text = "printer version<br /> <br />" + textValue;
After you add this code, you should probably test your application again. You should see something like the following figure.