startMovie

.
. Member 1: "startMovie" Cast 1: "Internal"
.
__

--^ Example.dir demo program to show off Teapot-7 Documentor
--^ Author Steve Taylor,June 1997
global gAnimals
global gCurAnimal
global gNames
global gNameIndex

on startMovie
  --^ assorted initialisations - names and animal objs
  set gAnimals = []
  add gAnimals, birth(script "mouse")
  add gAnimals, birth(script "snake")
  add gAnimals, birth(script "cat")
  add gAnimals, birth(script "dog")
  --
  set gNames = []
  -- dynamically grab names from text field - easy to alter
  repeat with i = 1 to the number of lines in the text of field "nameField"
    add gNames, line i of the text of field "nameField"
  end repeat
  --
  set gNameIndex = 1
  --
  setAnimal 1
end

--^ sets the current animal and displays it on screen
on setAnimal aNum
  set gCurAnimal = getAt(gAnimals, aNum)
  set the text of field "animalNameField" = "Current Animal is:" && speciesOf(gCurAnimal)
end

on animalChoice aNum
  -- so why didn't I just call setAnimal in the first place?
  setAnimal aNum
end

on nameChoice
  --^ name our wee beastie
  set the myName of gCurAnimal = getAt(gNames, gNameIndex)
end