Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Shocksites.com
SpriteMap
Bitbull
Timeline re-direction and navigation
DAlign
Scale-Alphamania
fading button on 1 sprite
Tracking save attempts
De-Xplode that text random
Spell Check Xtra
MediaMacros Xtras Mall
 

 

 

Behavior File Read/Write

Added on 7/19/2000

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: Shehal (website)

writes to text file

-- mailto: shehal@mediasolv.com
-- Refer Macromedia TechNote 03192
--http://www.macromedia.com/support/director/ts/documents/tn3192.html

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

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 deleteTextFile = TRUE then deleteFile
  writeFile
end

on writeFile
  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 "File Written: "&error(mFile,status(mFile))    
  end if
  closeFile (mFile)  
  set mFile = 0
end writeFile

on deleteFile
  
  if objectP(mFile) then set mFile = 0
  set mFile = new(xtra "fileio")
  if the moviePath = "" then
    alert "did you brush your teeth ??"
  else
    openFile (mFile, mDirectory&mTextFile&".txt",0)
    delete (mFile)
    alert "File Deleted: "&error(mFile,status(mFile))
  end if
  closefile (mfile)
  set mFile = 0
end deleteFile

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):"]
  
  addProp description, #deleteTextFile, [#default: TRUE, #format : #boolean, #comment: "Delete Old Text File: (Yes/No):"]
  
  return description
end getPropertyDescriptionList

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail