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
Reverse a list
AutoRez Monitor Resolution Switcher
IPIX
Sound 1 CuePoint
DeadC Scroll
Make Projector
Noise Algorithm 2
PictureXtra
Binary Xtra
Exploding Text Prepare Movie
 

 

 

Behavior Import text as cast members

Added on 6/8/1999

 

Compatibilities:
D6_5 Mac PC Script

This item has not yet been rated

Author: MediaMacros (website)

Use this to import a text file as text members. Each paragraph is made into a cast member. Make a text member named "copySource" with all the formatting you want. This is a solution for importing text prior to D7.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know.  :-)

on makeTextMembers whichFile  
  set myFile = new(xtra "fileio")
  openFile(myFile, whichFile, 1)        
  set theFile = readFile(myFile)      
  closeFile(myFile)                    
  set myFile = 0  
  set howManylines = the number of lines in theFile
  repeat with x = 1 to howManylines    
    if line x of theFile <> " " and line x of theFile <> "" then      
      set howManyMembers = the number of members of castlib 1
      duplicate member "copySource"
      set thisString = line x of theFile
      if char 1 of thisString = " " then
        set thisString = char 2 to (the number of chars in thisString) of thisString
      end if      
      set the name of member (howManyMembers + 1) to thisString
      set the text of member (howManyMembers + 1) = thisString
    end if    
  end repeat  
end

 


Contact

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

Send e-mail