1 Reply Latest reply on Feb 15, 2007 9:30 AM by michael_ramirez44

    Event Error

    187_2007 Level 1
      package Classes
      {

      public class FileUpload
      {


      private var textTypes:FileFilter = new FileFilter("Text Files (*.csv; *.txt)", "*.csv; *.txt");
      private var allTypes:Array = new Array(textTypes);
      private var fileRef:FileReference = new FileReference();


      public function findfile():void{
      fileRef.addEventListener(Event.SELECT, selectHandler);
      fileRef.addEventListener(Event.COMPLETE, completeHandler);
      fileRef.addEventListener(Event.CANCEL, cancelHandler);

      importLabel.text="Selecting File for Import";
      importLabel0.text = "";
      try {
      var success:Boolean = fileRef.browse(allTypes);
      } catch (error:Error) {
      trace("Unable to browse for files.");
      }
      }


      function selectHandler(event:Event):void {
      var request:URLRequest = new URLRequest(" http://apps.mywebsite.com/robert/SiteSpecSystem/CFC/fileUploadScript.cfm")
      try {
      fileRef.upload(request);
      } catch (error:Error) {
      Alert.show("Unable to upload file.");
      }
      }


      function completeHandler(event:Event):void {
      importLabel.text = fileRef.name;
      importLabel0.text = "Imported Sucessful";
      }

      function cancelHandler(event:Event):void {
      importLabel.text="Select File to Import";
      }
      }
      }


      This is a AS class that I have created.... This code was in my MAIN.MXML file and I pulled it out to make it a class.
      I am getting errors and I cannot understand why. I have BOLDED the areas where the errors occur and here is the error description below.

      Type was not found or was not a compile-time constant: Event

      Do I need to Import something? I don't understand why I am getting this error...