1 Reply Latest reply on Feb 26, 2007 4:32 AM by James Newton, ACP

    Classes in Director

    ajeet.ghule
      Hi:)
      I wanted to know if we can write classes in director.
      Can anyone please give me example for write a class and then initialise the object and calling methods of the class?
        • 1. Re: Classes in Director
          James Newton, ACP Level 3
          Classes in Director are called Parent scripts. Create a new script member. Name your script member "Test". In the Property Inspector, at the Script tab, set its scriptType to #parent.

          Give your script the following scriptText:

          property pValue

          on new(me)
          pValue = #someValue
          return me
          end new


          on GetValue(me)
          return pValue
          end GetValue


          on SetValue(me, aValue)
          pValue = aValue
          end SetValue


          Now compile your script by selecting Control | Compile All Scripts. In the Message window, type:

          vInstance = script("Test").new()
          put vInstance.GetValue()
          -- #someValue
          vInstance.SetValue(#NewValue)
          put vInstance.GetValue()
          -- #NewValue