Chained Behaviors

Chris Sheffield cmsheffield at icloud.com
Fri Jul 12 15:53:31 EDT 2013


Because each sprite would then have its own script, which would be identical to all the other sprites' scripts. Then if a change were needed, you'd have to go in and modify each additional script. Quite a nightmare if you have hundreds of them..

Chris

--
Chris Sheffield
Read Naturally, Inc.
www.readnaturally.com



On Jul 12, 2013, at 1:47 PM, Peter Haworth <pete at lcsql.com> wrote:

> On Fri, Jul 12, 2013 at 11:36 AM, J. Landman Gay
> <jacque at hyperactivesw.com>wrote:
> 
>> Remember that behaviors are not a single handler, they are whole scripts.
>> I have several sprites that require different behaviors on mouseUp but they
>> all have the same behaviors on mouseDown. With a chained behavior, I could
>> have placed the mouseDown handler into the "top" of the chain and different
>> mouseUp handlers in each separate behavior script underneath that:
>> 
>>       on mouseDown
>>         doDownStuff
>>       end mouseDown
>>         /        \
>> on mouseUp       on mouseUp
>> doBehavior1       doBehavior2
>> end mouseUp      end mouseUp
>> 
> 
> OK, good example, thanks.  I have to ask, though, why not have the unique
> mouseUp handlers in the sprite scripts and a behavior script for the common
> mouseDown handler?
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list