2 Replies Latest reply on Aug 6, 2007 8:15 AM by PDiLalla

    clear out newly created cast member

      Hi, I don't know much about Director yet, but I need to create an application for a client. The interface will be created dynamically from a XML file. I create my cast members in lingo (since I don't know how much menu items I will have untill the XML is read). So I use something like:

      newMember = new(#text)

      The problem is, it physically creates members in my cast that stay there even when I stop running my project. Is there a way to delete everything that has been created when the movie stops?

        • 1. Re: clear out newly created cast member
          Level 7
          You could store a list of members created. Then when the movie stops,
          walk this list and delete them. Something like:
          -- #movie script
          global glMembersCreated

          on prepareMovie
          glMembersCreated = []

          on mNewMemberCreated aMember
          if ilk(aMember, #member) then glMembersCreated.append(aMember)

          on stopMovie
          if offset("Author", _system.environmentPropList.runMode) then
          repeat with aMember in glMembersCreated
          end repeat
          glMembersCreated = []
          end if

          Then, whenever you create a new member, add it to the list:
          tMember = _movie.newMember(#text)
          tMember.text = ...
          • 2. Re: clear out newly created cast member
            PDiLalla Level 1
            Thanks, it works great