Behavior Locker

Date:    Mon, 30 Jun 1997 19:21:14 EDT
From:    John Dowdell <71333.42@CompuServe.COM>
Subject: Re: Are behaviors set in stone?
When thinking about what you wrote the following arose... it's a simple behavior that prevents other behaviors from adding themselves to the sprite's behavior set. Try dragging a few behaviors atop a sprite, then dropping this Behavior Locker atop, running the movie, and then trying to add another instance to the scriptInstanceList. The additions will be shrugged off. Not sure if it's along the lines you're looking at, but....

--  Misc Behavior Locker
--
--  Assures that no behaviors can be added to a sprite.
--  You'd likely wish to have this as the final behavior in the spriteList.
--  Can be foiled if someone reaches into the properties of this behavior.
--
--  History 6/30/97 jd written


property spriteNum, currentBehaviors, originalBehaviors

on beginSprite me
  set currentBehaviors to the scriptInstanceList of sprite spriteNum
  set originalBehaviors to duplicate(currentBehaviors)
end

on exitFrame me
  if currentBehaviors <> originalBehaviors then
    set the scriptInstanceList of sprite spriteNum to originalBehaviors
  end if
end