1 Reply Latest reply on Jul 30, 2011 8:57 PM by Mikey186

    code from flash pro CS5 to Flash Builder 4


      does anyone know how to get the code from flash CS5 to work to Flash builder 4?


      heres the code:



      import flash.filesystem.File;
      import flash.filesystem.FileMode;
      import flash.filesystem.FileStream;

      movieClip_1.addEventListener(MouseEvent.CLICK, fl_SaveFile);

      var fl_FileDataToSave:String = "Text to save to file.";

      var fl_SaveFileStream:FileStream = new FileStream(); // FileStream used to write to the file

      var fl_SaveFileChooser:File = File.documentsDirectory; // Default to the documents directory
      fl_SaveFileChooser.addEventListener(Event.SELECT, fl_WriteFileHandler);

      // Opens a Save As dialog box for user to specify a file name
      function fl_SaveFile(event:MouseEvent):void
      fl_SaveFileChooser.browseForSave("Save As:");

      // Write data in fl_FileDataToSave variable
      function fl_WriteFileHandler(event:Event):void
      fl_SaveFileChooser = event.target as File;
      fl_SaveFileStream = new FileStream();

      fl_SaveFileStream.openAsync(fl_SaveFileChooser, FileMode.WRITE);

      fl_SaveFileStream.writeMultiByte(fl_FileDataToSave, File.systemCharset);