Page 1 of 1

In what context does a backscript run?

Posted: Thu Jan 19, 2017 8:51 pm
by dpatterson
I am attempting to place a card script into back.
It appears that it when it is called, it is no longer in the context of the card that owns it.

So, the question is: What is the context?

TIA,
Dave

Re: In what context does a backscript run?

Posted: Tue Jan 24, 2017 5:52 pm
by MaxV
It depends of what do you intend for context.
For example I have a button named button2 with this code:

Code: Select all

on mouseUp
   answer the long name of me
end mouseUp
then I type in the message box:

Code: Select all

insert script of button "button2" into back
Now when I click on my stack I get: button "button2" of card id 1002 of stack "/home/max/temp/example.livecode"

So it's owner and context to me is the same, you can use properties as usual.

Re: In what context does a backscript run?

Posted: Tue Jan 24, 2017 6:16 pm
by dunbarx
What Max said.

Just like behaviors, the target retains its "local" character, regardless of the place in the hierarchy where a message is ultimately trapped.

Craig