> Would this work?
> put ((member "does not exist").number > 0)
> -- 0
Nope, that will fail if the scriptExecutionStyle is set to 10 as the
invalid member reference returns VOID, and VOID does not have a number
property and so a script error will occur. The problem here is that
prior to MX'04 all the top-level functions behaved erraticaly when the
requested object didn't exist:
window("foo") -> if "foo" didn't exist a new window object was created
member("foo") -> if "foo" didn't exist a reference to member -1 of
castlib 1 was created
Script("foo") -> if "foo" didn't exist a script error would occur
And so on... So the decision was made to to have all top-level functions
behave the same in that now they all return a VOID value if the object
doesn't exist, thus changing how you do things like create timeout
objects, berth windows and of course check for non-existant members. For
you Valentin, I'd suggest something like this:
tMemRef = member("Some Name")
if voidP(tMemRef) then
-- you know the member doesn't exist
-- and you also know that you're in v10 with ses=10
else
if (tMemRef.number < 0) then
-- you know the member doesn't exist
-- and you know that ses<10
else
-- you know the member does exist
end if
end if
Or something similar of course, but in a single line of code you are not
going to be able to check for the member existing for both scenarios
(where scriptExecutionStyle is 9 or 10 [called ses above]).
Cheers,
Tom Higgins - Technical Product Manager
Macromedia Director and the Shockwave Player
http://weblogs.macromedia.com/thiggins/
...
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]