Using Javascript

Although Javascript in Director is far from perfect (slower than lingo, some nasty bugs such as "setPref crashing Director":, and general lack of useful documentation) - there are some reasons to use it - at least to provide some functionality not otherwise available in Lingo. For example, Javascript syntax gives you access to regular expressions for searching and replacing text. Although quite limited compared to the "PregEx Xtra": - it will work in Shockwave (unlike PregEx). "Here is an example script": with some wrapper functions for searching, replacing and splitting strings with regular expressions. Note, however, that the regular expression object doesn't seem quite complete in Director (for example, the results of a re.exec(str) seem to be missing a few properties). There are also several algorithms implemented in Javascript that can be used in Director 'as is'. For example, here are some javascript implementations of "Blowfish": and "Block TEA": (Tiny Encryption Algorithm) * "Blowfish": * "Block TEA": You can simply cut and paste these scripts into Director, and they work as is (although they may be limited by Director's internal handling of text?).
First published 18/02/2006