preOpenCard inside behaviors, does it works?

DunbarX at aol.com DunbarX at aol.com
Tue Jun 22 16:01:45 EDT 2010


Hmmm.

Remember that the "preOpenCard" message is sent to the current card, not to 
a button on the card. Is that what the problem is, that the message is 
starting too high? I think there is a slight misunderstanding of the 
terminology.

You need to set the behavior of the card to (the script of) the button. The 
preOpenCard message will be automatically sent to the card (it is a system 
message) and it will then be passed to the button, just as if you explicilty 
sent it there. So you are not setting the behavior of the button, but 
rather the card. The button is the repository of the script, and is the "target" 
of the card's behavior, but its own behavior is irrelevant, and is not 
tampered with.

Try the simple stack I made. See how the button script is invoked when the 
card opens? The card has no script itself, only a behavior pointing to the 
button.

Craig Newman

In a message dated 6/22/10 3:45:48 PM, andre at andregarzia.com writes:


> Mark & Craig,
> 
> 
> if you have a preOpenCard in a behavior script and set the behavior of a
> button to that script, does it fires when you navigate to the card that
> contains the button?
> 
> Cheers
> 
> 



More information about the use-livecode mailing list