Chained Behaviors

Peter Haworth pete at lcsql.com
Fri Jul 12 16:44:32 EDT 2013


Ah OK, that makes sense. I had the impression that each sprite needed
mouseUp logic that was unique to it.  I think I'm now seeing the usefulness
of this.

I'm thinking there might be a spot for a utility that, for any given
control, lists the message handlers it uses and where they reside.....

Pete
lcSQL Software <http://www.lcsql.com>


On Fri, Jul 12, 2013 at 1:31 PM, J. Landman Gay <jacque at hyperactivesw.com>wrote:

> On 7/12/13 2:47 PM, Peter Haworth 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?
>>
>
> Well, there are four different behaviors (so far,) applied to hundreds of
> objects spread across dozens of stacks. If I needed to change anything, I'd
> be in there for weeks or I'd have to script an auto-scripter. Also, the
> bulk of all those repetitions would unnecessarily increase the stack size.
> One of the mouseUp behaviors is 200 lines long.
>
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>



More information about the use-livecode mailing list