Hi Townsend,
check the "User Guide" (Menu: Help)
I copied that part for our conveninece

###################################################
5.8.7 Writing reusable code using behaviors
Behaviors are a method to create common functionality between objects without duplicating the scripts.
An object with a behavior set will act as though its script was set to the script of the behavior button.
If multiple objects share the same behavior, each will have its own set of script local variables.
Any references to me, the owner of me, etc will resolve to the child object currently executing.
Behavior scripts must be stored in button objects. To set an object’s behavior, refer to the long id of the button containing the behavior script.
##################################################
Basically you create a button, give it a meaningful name and add as much scripts as you need.
'Then you can create new button(s) and just attach that buttons "behavior" to the new button:
Code: Select all
on mouseUp
put "click me" into temp
create button temp
set the loc of it to 100,100
...
set the behavior of it to the long ID of btn "your premade behavior button here" of cd X ## of stack Y
end mouseUp
Done!
This is a great way to avoid the "scriptlimits".
With clever use of custom properties you can even have more control, since you can attach different
custom properties to newly created objects and with something like "the cProperty of ME" you can even
have different actions with the same behavior. Know what I mean?
Best
Klaus