5 Replies Latest reply on Aug 13, 2008 7:18 AM by Cinem@TOR

    A Variable as Property List Index

    Cinem@TOR
      Hi, everyone!

      I want to add property and value to property list, using variable as index, like that:

      listQuestions = [:]

      repeat with i = gFirstLine to gLastLine -- gFirstLine and gLastLine calculated from source text by line.count
      if member("TextSource").line contains "№" then
      N = N + 1
      if member("TextSource").line
      contains "Answer" then -- if text contains "Answer", then use it as Marker Name
      listQuestions[N] = ["mAnswer":i]
      end if
      if member("TextSource").line contains "Microphone" then
      listQuestions[N] = ["mMic":i]
      end if
      if member("TextSource").line
      contains "Insert" then
      listQuestions[N] = ["mInsert":i]
      end if
      end if
      end repeat

      And when play the movie, Director outputs error:

      Script Error: Index out of range
      listQuestions[N] = ["mMic":i]

      I tried to create property list like that:
      listQuestions = ["1",1, "2",2, "3",3]
      or
      listQuestions = [#1:1, #2:2, #3:3]
      or even like that:
      listQuestions = propList("1",1, "2",2, "3",3, "4",4, "5",5)

      Same error.

      How can I use a variable as index of Property List?

      Can someone help me, please?