Page 1 of 1

Behaviours qustion

Posted: Mon Mar 08, 2010 10:26 pm
by phaworth
I have a lot of objects in my app that would benefit from behaviour scripts instead of having the code local to them. There's one detail that has stopped me from doing that so far. Occasionally, an object will need to need to execute some extra code unique to itself after the behaviour script has executed. What's the best way to handle that situation?
Thanks,
Pete

Re: Behaviours qustion

Posted: Tue Mar 09, 2010 12:12 am
by mwieder
Use the dispatch command in the behavior script:

button 1 (the behavior button):

Code: Select all

on mouseUp
  put "hello" after msg
  dispatch "morestuff"
end mouseUp
button 2:

Code: Select all

on morestuff
  put "more stuff" after msg
end morestuff
if there's a morestuff handler in the child control it will be called, otherwise it will just be passed on.