A simple way to distribute your lingo without giving away all your hard work is to use a protected movie-in-a-window (MIAW).
Both Projectors AND the Director application can open these, making this approach handy for collaborations between developers.
Here's an example:
tell window("xLingo") to myBox = new(script "alertBox parent")
This trick is also handy for sharing code libraries with your own colleagues ‹ simply by helping to ensure change control within the team.
Protected movies containing script members have their scriptText removed, making it impossible to view or change their source code.
There are a few things to be aware of if you adopt this approach:
(1) forget about using externally linked scripts for the moment (a feature available in D8) ‹ Director doesn't currently internalize linked scripts when protecting its files (doh!);
(2) remember that distributing your files in protected form means that your end-user(s) can't subsequently embed them inside their own projectors;
(3) this approach is no good for Shockwave ‹ SW doesn't currently support MIAWs;
Also, do bear in mind that scripts within so-called "protected" files aren't protected in any PROGRAMMING sense. That is, you can still meddle with the internals of a child object, calling ANY method it contains, and twiddling any of its properties directly:
-- get a lingo instance from anywhere:
o = myNewObject
-- let's have a peek at ALL of its methods:
put o.handlers()
-- and let's see ALL it's properties:
repeat with i = 1 to count(o)
propName = getPropAt(o,i)
propVal = getaProp(o,propName)
put propName && propVal
end repeat
-- now we can screw around:
o.setInternalID()
-- or even:
o.internalID = whateverIwant
So while your script users can't view or interfere with your source, they're still free to bypass any of your documented 'public' methods, and do whatever they want with your objects at runtime. Because it's necessary to have at least one persistent reference to an object in Lingo, you can always find a way to access any object ‹ at least, I can't think of a way to prevent a determined person from doing it!
About the xLingo example:
I've included a pretty useful example (in D8 format only) for illustration purposes ‹ do check out the scripts documentation facility I've included. To the Java people out there, its a child's flattery of JavaDoc. Basically, it compiles your user-help documentation from flagged script comments ‹ have a look.
My wish list:
A lingo library xtra to make all the above nonsense obsolete!
If I've thought of a problem, someone else has almost certainly already solved it ...
:o)
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA