Objects sharing scripts
Posted: Tue Apr 19, 2016 9:43 pm
No doubt this is a simple question, but I haven't been able to find the answer in a lot of searching of the forum, Google, and the User Guide. So, I hope somebody can spare a minute or two to save me more time scratching my head.
All I need is for a group of buttons or images on the same card to share the same script. Behaviors seem to be what I'm looking for, and indeed, that's the same term used in Director, the platform I'm migrating from.
When I issue the command:
set the behavior of button "Button 2" to the long id of button "Button 1"
then
button id 1009 of stack "Test Behaviors"
shows up in the Behavior field of the Basic Properties pane of Button 2. So far so good.
But, this script:
on mouseUp
answer the name of me
end mouseUp
assigned to Button 1 executes correctly when I click Button 1, but not Button 2. So, obviously I'm not doing it right.
And the solution is not
on mouseUp me
as it would be on Director.
This stuff is easy and straightforward on Director. I'm sure the same is the case on LiveCode; if I could just figure out how!
Thanks!
All I need is for a group of buttons or images on the same card to share the same script. Behaviors seem to be what I'm looking for, and indeed, that's the same term used in Director, the platform I'm migrating from.
When I issue the command:
set the behavior of button "Button 2" to the long id of button "Button 1"
then
button id 1009 of stack "Test Behaviors"
shows up in the Behavior field of the Basic Properties pane of Button 2. So far so good.
But, this script:
on mouseUp
answer the name of me
end mouseUp
assigned to Button 1 executes correctly when I click Button 1, but not Button 2. So, obviously I'm not doing it right.
And the solution is not
on mouseUp me
as it would be on Director.
This stuff is easy and straightforward on Director. I'm sure the same is the case on LiveCode; if I could just figure out how!
Thanks!