2 Replies Latest reply on Mar 29, 2010 1:34 AM by richtextformat

    FileStream fires no Events

    richtextformat Level 1

      I'm simply doing this:

      import org.alivepdf.pdf.PDF;


      private var _fs:FileStream;


      var printPDF:PDF = new PDF( Orientation.PORTRAIT, Unit.MM, ps );


      _fs = new FileStream();
      _fs.addEventListener(OutputProgressEvent.OUTPUT_PROGRESS, onOutput);
      _fs.addEventListener(ProgressEvent.PROGRESS, onProgress);
      _fs.addEventListener(Event.COMPLETE, onComplete);
      _fs.addEventListener(Event.ACTIVATE, onActivation);
      _fs.addEventListener(IOErrorEvent.IO_ERROR, onIOError);


      _fs.openAsync(file, FileMode.WRITE);   
      var bytes:ByteArray = printPDF.save(Method.LOCAL);  


      The only event that is firing is OutputProgressEvent.OUTPUT_PROGRESS, which is giving me [once]:


      private function onOutput (event:OutputProgressEvent):void

           trace(event.bytesPending, event.bytesTotal);



      trace output here being:


      0 / 229779


      Nothing else fires, meaning I can't close the FileStream session, meaning starting a second causes this error:


      Error #2041, Only one file browsing session may be performed at a time


      Been struggling for days. Going mental. Any ideas?

        • 1. Re: FileStream fires no Events



             I am facing similar problem with my applcation. Did u got the solution? Also I want  to know


          How to add page numbers to the generated PDF, if it has multiple paes.


          Also when I am using Tab navigator,  which is based on ViewStack and my creation policy is auto. When I am not selecting the other tabs, they are not created and so how can I generate their data in PDF?


          Pleae let me know if you knoe anything about these. I am using   ALivePDF 0.1.5

          • 2. Re: FileStream fires no Events
            richtextformat Level 1

            hello fresher4flex


            no, but i did manage to work around it by enclosing problematic FileStream code snippets in try/catch statements. Now I can create multiple pdfs all day.


            I was also using AlivePDF