2 Replies Latest reply on Jun 15, 2007 1:33 PM by Newsgroup_User

    Remove puppeted sprites from stage

    martijntijn
      I have placed sprites on the stage using puppeting and added a behavior:

      sprite((j * levelRows) + i).puppet = true
      sprite((j * levelRows) + i).member = member("tile")
      sprite((j * levelColumns) + i).loc = point(x, y)
      add sprite((j * levelColumns) + i).scriptInstanceList, new(script "tileScript", i)



      Now, when the sprite isnt needed anymore i 'unpuppet' the sprite using:

      sprite((j * levelRows) + i).puppet = false


      But the sprite doesnt completly removes. It doesnt show up anymore, but somehow it still exists. The behavior still exists. Like for example: the tileScript makes a noise when the character hits that tile. After the tile is unpuppeted the sound is still there when the character moves over the place where the tile was.

      Anyone got a clou?
        • 1. Re: Remove puppeted sprites from stage
          Level 7
          If you are using MX2004 you could try makeScriptedSprite() and
          removeScriptedSprite()
          Otherwise, you should be careful to remove the behavior instance
          /before/ unpuppeting (and hope that the same channel isn't used
          elsewhere in the score with a script attached during authoring)
          • 2. Re: Remove puppeted sprites from stage
            Level 7

            "martijntijn" <webforumsuser@macromedia.com> wrote in message
            news:f4uqu4$l2p$1@forums.macromedia.com...
            >I have placed sprites on the stage using puppeting and added a behavior:
            >
            > sprite((j * levelRows) + i).puppet = true
            > sprite((j * levelRows) + i).member = member("tile")
            > sprite((j * levelColumns) + i).loc = point(x, y)
            > add sprite((j * levelColumns) + i).scriptInstanceList, new(script
            > "tileScript", i)
            >
            >

            >
            > Now, when the sprite isnt needed anymore i 'unpuppet' the sprite using:
            >
            > sprite((j * levelRows) + i).puppet = false
            >

            >
            > But the sprite doesnt completly removes. It doesnt show up anymore, but
            > somehow it still exists. The behavior still exists. Like for example: the
            > tileScript makes a noise when the character hits that tile. After the tile
            > is
            > unpuppeted the sound is still there when the character moves over the
            > place
            > where the tile was.
            >
            > Anyone got a clou?

            Well yes.
            My mother always told me to clean up after myself....
            ... and that is probably what you need to do as well :-)

            You undo the puppeting, but do not "clean up" the other 3 things:
            -The script
            - The location
            - The member of the sprite

            thats not good housekeeping .. ;)

            Richard.