3 Replies Latest reply on Mar 3, 2008 6:41 AM by thejokerman05

    Can't compile...

    thejokerman05
      I get this error:
      1136: Incorrect number of arguments. Expected 1

      [code]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="762">

      <mx:Script>
      <![CDATA[

      public var file:FileReference;

      public function selectFile():void {
      file = new FileReference();
      file.addEventListener(Event.SELECT, fileSelected);
      file.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadDataComplete);
      file.addEventListener(Event.COMPLETE, uploadComplete);
      file.addEventListener(IOErrorEvent.IO_ERROR, handleError);
      file.browse();
      }

      public function handleError(event:IOErrorEvent):void {
      status_txt.text = 'ERROR: ' + event.text + '\n';
      }

      public function fileSelected(event:Event):void {
      file = FileReference(event.target);
      file_txt.text = file.name + '\n';
      }

      public function uploadFile(event:Event):void {
      var request:URLRequest = new URLRequest();
      request.url = "upload3.php";
      file.upload(request);
      }

      public function uploadDataComplete(event:DataEvent):void {
      var result:XML = new XML(event.data);
      status_txt.text += 'Upload Data Complete\n'
      status_txt.text += 'RESULT: ' + result.toString() + '\n'
      status_txt.text += 'STATUS: ' + result.status + '\n';
      status_txt.text += 'MESSAGE: '+ result.message;
      }

      public function uploadComplete(event:Event):void {
      status_txt.text += 'Upload complete\n';
      }

      ]]>
      </mx:Script>

      <mx:HBox x="30" y="25">
      <mx:Button id="select_btn" label="Browse" click="selectFile();"/>
      <mx:Button id="upload_btn" label="Upload" click="uploadFile();"/>
      <mx:TextArea id="file_txt" height="22" width="250"/>
      </mx:HBox>

      <mx:TextArea x="30" y="60" id="status_txt" width="400" height="150"/>

      </mx:Application>
      [/code]