Recursion warning: what's the owner of a background?

David Bovill david at vaudevillecourt.tv
Thu Dec 23 06:34:36 EST 2010


This one just caught me out. I have a script that checks a property of it's
owner and returns the value. Specifically it checks the owner for a property
of the same name to see when the local value is empty to see if it is
defined higher up in the object hierarchy. I thought this would be a safe
way of implementing object oriented stuff.

But you get recursion when the control is a background, because the owner of
a background is the card the background is on, but the card is actually
below the background in the message hierarchy, so the background script gets
triggered again when you look for it in the backgrounds owner.

A recursive tongue twister maybe - but just remember a background's owner is
itself in scripting terms!



More information about the use-livecode mailing list