Multimedia Programming
Basic Lingo
Storing Information

  1. Ways to store information:

    1. Global variable. Use global variables whenever you want information from one script to be used in another script.

      1. Must initialize it in the movie script.

        		on startMovie
        			global theName
        
        			set theName = "none"
        		end
        

      2. Must declare the variable as global in every script that you use the variable.

        		on mouseUp
        			global theName
        
        			put field "Name entry" into theName
        
        		end
        

    2. Field. You can store information in a field cast member:

      on userInfo set IdOfClient = the number of lines in field "FirstName" -- -- stores an integer ID for the test-taker, which is -- determined from the number of entries already made -- The number of lines is initialized to one in startMovie. -- set line IdOfClient of field "FirstName" to the text of cast "FirstName Entry" set line IdOfClient of field "LastName" to the text of cast "LastName Entry" set line IdOfClient of field "EmployeeID" to the text of cast "ID Entry" set the text of cast "FirstName Entry" to EMPTY set the text of cast "LastName Entry" to EMPTY set the text of cast "ID Entry" to EMPTY -- set line IdOfClient + 1 of field "FirstName" to "--" end

      In this example, there are three fields that the user fills in named FirstName Entry, LastName Entry, and ID Entry. The values of these for all users are stored in the fields "FirstName", "LastName", and "EmployeeID".

      The script works by finding out how many lines the field "FirstName" has. Since the last entry in the field is "--" (put in by the last line of the script), this is the number of the line where we will store the next entry.

      After we have the entry line, we can take information from the input fields and put them into the appropriate lines of the storage fields. Then we put "--" into the last line of the "FirstName" field so that we know where to start the next time.

    3. You can store information in an external file. Must use an XObject (see chapter 9 of Director Close-Up).

  2. Lists. This is a structure that enables you to store multiple items in a single variable and to access them in different ways.

Return to Student Home Page

Last Modified: 6 April 1998

THIS PAGE MAINTAINED BY:
John Barr, Ithaca College