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
Go to Different Movie
Clipboard Xtra
Wait For Media Ready
Microangelo
Video Mask
Increase/ Decrease FrameRate of a Flash Member
List Inspector
Spam and Faoul language filter for shockwave
Convert Decimal to Comma (EU)
3D SpeedPort Xtra
 

 

 

Behavior Read Text From File into Member w/ open dialog

Added on 2/15/2000

 

Compatibilities:
D6_5 D7 D8 Mac PC Script

This item has not yet been rated

Author: Macromedia (website)

From Technote #3192 at Macromedia.com

on readFromFile
    if objectP(myFile) then set myFile = 0  --Delete the instance if it already exists
    set myFile = new(xtra "fileio")    -- Create an instance of FileIO
    if the machinetype = 256 then
        setfiltermask (myfile, "All files,*.*,Text files,*.txt") -- set the filter mask (Win)
    else
        setfiltermask (myfile, "TEXT")     -- set the filter mask (Mac)
    end if
    set fileName = displayOpen(myFile) -- display the "Open" dialog
         if not voidP(filename) and not (filename = EMPTY) then
             openFile(myFile, filename, 1) -- open file that user selected
             if status(myFile) = 0 then
                    set theFile = readFile(myFile) -- Read the file into a Lingo variable            
                    put theFile into field "myField" -- display the text in a field
                else
                    alert error(myfile,status(myfile)) -- display error message
                end if
            end if
    closeFile(myFile)                    -- Close the file
    set myFile = 0                       -- Dispose of the instance
end

 


Contact

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

Send e-mail