1 Reply Latest reply on Sep 7, 2006 7:06 AM by Newsgroup_User

    export text

    InclusiveCEO
      Hi again all,

      Is there a way to create a text field in a movie and save what is typed in as a file text file on the desktop of the computer that is running the movie?
        • 1. Re: export text
          Level 7
          InclusiveCEO wrote:
          > Hi again all,
          >
          > Is there a way to create a text field in a movie and save what is typed in as a file text file on the desktop of the computer that is running the movie?

          Sure. You can just copy this into your behavior and call the saveText
          function from wherever you need it. Just be sure to look out for my
          comment lines here that have wrapped around to the next line.

          ------------------------------------------------------------------------------------------ ---------------------
          -- This version of the save function saves the text member to the user's
          -- hard drive so they can open it in a spreadsheet program.
          ------------------------------------------------------------------------------------------ ---------------------
          on saveText text
          fileObj1 = new(xtra "FileIO") --create the FileIO instance
          setFilterMask(fileObj1, "Text Files, *.txt, All Files, *.*") --set
          the filter mask to text files

          filename = displaySave(fileObj1,"","C:\WhateverFile.txt") --display
          the save dialog box
          if filename = "" then return FALSE --check to see if cancel was hit
          createFile(fileObj1, filename) --create the file
          openFile(fileObj1, filename, 2) --open the file

          if status(fileObj1) <> 0 then --check to see if file opened ok
          err = error(fileObj1, status(fileObj1))
          alert "Error:"&&err
          return FALSE
          end if

          writeString(fileObj1, member("WhateverMember").text) --write the file

          closeFile(fileObj1) --close the file
          return TRUE
          end