title: Simple Flash form, redirecting to URL using textfield as argument
body: <p>This seemed simple enough, I do know Java, PHP and JavaScript, so it's simply a matter of not enough knowledge of the Flash/ActionScript 3.0 platform.</p>
  
  <p>After doing some research, I added a layer to the movie for the code (Flash CS5). I then right-click, select "Actions" and write this code.</p>
  
  <pre><code>addEventListener(Event.ENTER_FRAME, setup);
  
  submitButton.addEventListener(MouseEvent.CLICK, onSubmit);
  queryField.addEventListener(MouseEvent.CLICK, onQueryClick);
  
  var defaultText = "Search...";
  
  function setup(){
      queryField.text = defaultText;
  }
  function onSubmit(){
      if(queryField.text != defaultText &amp;&amp; queryField.text != ""){
          navigateToURL(new URLRequest("http://www.somedomain.com/?query=" + queryField.text), "_blank");
      }
  }
  function onQueryClick(){ 
      if(queryField.text == defaultText){
          queryField.text = "";
      }
  }
  </code></pre>
  
  <p>As you can see, I want to add a default text on load to the form field referenced by "queryField", which should clear on focusing the field. When submitting the form the browser should redirect to an URL appending the value of queryField.</p>
  
  <p>As I said, I don't have enough knowledge of the platform to know what's wrong. Although it seems like maybe the references in the functions are not available due to the different scope. But a different example I saw ignored scope of form field references as well.</p>
  
  <p>Right now, the published movies does precisely nothing.</p>