Is there a way to add a property to a sprite’s existing
properties such that it can be accessed with syntax similar to
sprite(i).pProperty just like sprite(i).loc or sprite(i).rect?
I’m trying to use the following behavior to assign a
new property pScrollEnable to a bunch of proxy sprites. The
behavior itself doesn’t throw an error but testing
sprite(i).pScrollEnable throws a property not found error.
sprite(1).customProperty will always throw an error if the
movie is not running. If you attach your behavior to sprite(1),
then run the movie... and then try to access the property that you
set in the behavior, it should work fine.
Having said that, it is generally considered better practice
to create an accessor method for the behavior, rather than querying
an instance's (supposedly) private properties from outside:
-- In the behavior
-- In the Message window
put sprite(1).IsScrollable() -- may throw a script error if
the behavior is missing from sprite(1)
put sendSprite(1, #isScrollable) -- will fail