> Anyone know how to (or if its possible) to share properties between multiple > behaviors on the same sprite? Just declaring the same properties in the > scripts doesnt seem to work. > The best i could get was to use a sendSprite(sprite(me.spriteNum), > #setProperty), and register the property in the additional behaviors. > Any ideas of "cleaner" ways of doing this?!?!
Another way is to use lists to 'package' together shared information. Each behaviour can then store a reference to the one list containing all the data you want to share -- eg. property mySharedProps on beginSprite me sendSprite(me.spriteNum, #mShareProps, [:]) end on mShareProps (me, aList) mySharedProps = aList mySharedProps[#PropName] = "Value" -- each behaviour adds to the same list end However, if you think of one of the behaviours as a specialised instance of the other, then the "cleanest" thing to do is recast the broader behaviour as an ancestor of the more specialised version. Luke [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
