Killing Moon Software Community Zone
director

Shockwave Downloads

Base 64
Dynamic Puppets

Lingo Tests »
Optimisations »
Quirks »


Links
 

Dynamic Puppets

The following was originally posted on macromedia.director.lingo in October 2001. The article has been reposted many times with occasional minor corrections. The following is the most recent version.

You are looking at dynamic puppets which are undocumented and therefore can cause some problems. The correct way to do it is to put the sprite in the score in a hidden location, then change the member, loc and visibility properties accordingly when you need to. Unfortunately this way you cannot change the type of the member (so bitmaps and shapes cannot be mixed on the same channel).

However, you can leave the plane empty, which allows you use whatever type you like, but you are more likely to run into problems this way, and this is what macromedia will tell you not to do, because it is undocumented and unsupported. What you have to watch is that you set all the properties for the sprite when you create it, otherwise you may end up with some properties left over from a previous sprite. Do something like this:

spriteNum = 100
MyMember = member "thing" of cast "resources cast"
MySprite = sprite( spriteNum )

puppetSprite spriteNum, true
MySprite.member = MyMember
MySprite.width = MyMember.width
MySprite.height = MyMember.height
MySprite.loc = point( 100, 100 ) - Or whatever the location should be
MySprite.blend = 100
MySprite.Ink = 0
MySprite.Visible = true

When you want to "destroy" a sprite, just do something like this:

MySprite.ScriptInstanceList = []
MySprite.Cursor = 0
MySprite.Member = void

Remember that this does not really destroy anything, which is why you have to set all the properties again next time you need to use that channel. You also need to keep your own list of which sprites are in use, because there is no automatic way to tell. You can use lists to do this, I use a generic object which I will post if you can't solve that problem yourself.

You should also be aware that if you need to jump to another frame in your movie then all your dynamic sprites will override anything that is in the score in your other frames. The easiest way around this is to keep non-dynamic sprites in the low numbered sprite channels, and keep dynamic sprites higher up, so there are no conflicts.


 
Copyright © Robert Tweed, 2001-2005