2 Replies Latest reply on Nov 4, 2009 1:46 PM by rgadiparthi

    1046: Type was not found or was not a compile-time constant: FileStream.

    Natarajan S Visu

      Hi,

       

      I am a newbee developing codes using Adobe Flex. I have written the following  code to write an xml file to the disk.

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <mx:Script>

      <![CDATA[

       

       

      import mx.rpc.events.FaultEvent;

       

       

      import mx.rpc.events.ResultEvent;

       

       

      import mx.controls.Alert;

       

       

      import flash.filesystem;

       

       

       

       

       

      [

      Bindable]

       

       

      private var requestedId:Number;

       

       

       

      //trace the result of the service out

       

       

      private function serviceResult(event:Event):void

      {

       

       

      trace

      (service.lastResult.name);

      }

       

       

       

      // in the event that the service faults or times out

       

       

      private function serviceFault(event:Event):void

      {

       

       

      trace('broken service'

      );

      }

       

       

       

      private function callService():void

      {

      service.send();

      SaveData.enabled =

       

      true

      ;

      }

       

       

       

      private function SaveXML():void

      {

      service.lastResult.family_name = family_name.text;

      service.lastResult.individual_name = individual_name.text;

      service.lastResult.unattached_prefix = unattached_prefix.text;

      service.lastResult.middle_name = middle_name.text;

      service.lastResult.familiar_name = familiar_name.text;

      service.lastResult.suffix = suffix.text;

      service.lastResult.full_name = full_name.text;

       

       

       

      var newXMLStr:String="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"

      +service.lastResult.toxmlstring();

      var fs:fileStream =

      new FileStream();

      fs.open(file, FileMode.WRITE);

      fs.writeUTFBytes(newXMLStr);

      fs.close();

       

      }

       

      ]]>

       

       

      </mx:Script>

      --

       

      But when I compile the code, I got the error as mentioned in the topic title. Can you some one help to find out the possible problems?

       

      Thanks,

       

      Visu