Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Play/Pause/Rewind a Animated Gif Sprite
PDF files on the fly
Risk
Dryclean
toggle a global variable with button
Set Cast member Properties of a QuickTime
Acrobat ActiveX Control
Set DirectToStage of a Animated Gif Sprite
3D Rotation
Moka Xtra
 

 

 

Behavior write/append to text file

Added on 7/16/2000

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: Shehal (website)

Writes and appends to a specified text file.

property mFile
global mTextFile
property mTextField
global mDirectory
property textFieldsList
property defaultTextField

on beginSprite me
  textFieldsList = []
  maxCastLib = the number of castLibs
  repeat with theCastLib = 1 to maxCastLib
    maxMember = the number of members of castLib theCastLib
    repeat with memNumber = 1 to maxMember
      set ooMember = member(memNumber, theCastLib)
      if ooMember.type = #field then
        if ooMember.name = EMPTY then
          textFieldsList.append(ooMember)
        else
          textFieldsList.append(ooMember.name)
        end if
      end if
    end repeat
  end repeat
  return textFieldsList
  defaultTextField = textFieldsList[1]
end beginSprite


on mouseUp
  if objectP(mFile) then set mFile = 0
  set theFile = the text of field mTextField  
  set mFile = new(xtra "fileio")      
  if the moviePath = "" then
    alert "did you brush your teeth ??"
  else
    createFile( mFile, mDirectory&mTextFile&".txt")    
    openFile(mFile, mDirectory&mTextFile&".txt",0)  
    setPosition(mFile,getLength(mFile))  
    writeString(mFile, theFile)        
    alert "Status: "&error(mFile,status(mFile))    
  end if
  closeFile (mFile)  
  set mFile = 0
end

on getPropertyDescriptionList
  set description = [:]
  
  addProp description, #mTextField, [#range  : textFieldsList, #format : #field, #comment: "Enter Text Field:", #default: defaultTextField]  
  addProp description, #mDirectory, [#default: the moviePath, #format : #string, #comment: "Directory Path:"]  
  addProp description, #mTextFile, [#default: "boohaha", #format : #string, #comment: "Name of Text File (.txt will be added):"]  
  return description
end getPropertyDescriptionList

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail