title: How to make actionscript 2 interpret code as plain text?
body: <p>I'm trying to make a flash-based activity where the end-user will type in some Java as a writing exercise, and when it's done, they will hit enter and flash will check to see if they typed correctly.  </p>
  
  <p>The problem comes where I am writing the actionscript. When I test the movie, flash throws out lots of errors because it thinks the Java I typed in the input text box is just poorly formatted code. The code I am using has worked in the past for simple things like typing a name, or a number, but with the code-type input, it breaks. I know there are tags in HTML to display code as text, but I can't find anything about how to do this within actionscript 2. Here's what I have:</p>
  
  <pre><code>keyListener = new Object();
  keyListener.onKeyDown = function() {
  if(Key.getCode() == Key.ENTER){
  if(allthecode.text == "
      // Import the required API classes.
      import java.util.Scanner;
   
      public class ShowByte 
      {
      public static void main(String[] args) 
      {
      // Create the scanner.
      Scanner GetByte = new Scanner(System.in);
  
      // Obtain a byte value.
      System.out.print("Type any number: ");
      byte MyByte = GetByte.nextByte();
  
      // Display the value on screen.
      System.out.println("The value of MyByte is: " + MyByte);
      }
      }
      ") {gotoAndPlay(150);
          }
      }
  };
  Key.addListener(keyListener);
  </code></pre>
  
  <p>EDIT:Lee figured out it was that the code was on multiple lines. As soon as I placed everything within '   ' marks and scrunched everything up to a single line, it worked!</p>