At 5:58 PM +0000 12/18/00, Pranav  Negandhi wrote:
>OK guys...this one's a real googly. I created the following script:
>
>property pName
>
>on new me, vName
>   pName = vname
>   return me
>end new me
>
>on show me
>   put pName
>end show me
>
>I keyed in the following in the Message window:
>
>gInstance = new(script "Parent", "Pranav")
>put gInstance.show()
>
>and as expected, I get "Pranav" in the output.
>Now here's the glitch. The script is NOT a Parent, but a Movie script.
>Now, agreed, that it might be possible to make instances of movie 
>scripts, but then, whats the use of Parent scripts? Anyones got any 
>answers?
>


A real "googly"?  (I like that!)

Without trying it myself, I will guess that it will work.  But 
inadvertantly, you have created an insidious bug.  Since you have 
define an "on new" handler in a movie script, you have now 
overwritten Director's real "new" handler.  The problem is that you 
cannot now call the new function in Director create new things like 
bitmaps, scripts, cast members, xtras, etc.  (Try creating a second 
script like this where you intend it to be a parent script, but make 
it a movie script - does it instantiate an object of your second 
type??)

I have done this by accident many times and have learned that this is 
a very bad thing.  If you want it to be a parent script - make sure 
that you set its type to be a parent script.

Irv
-- 
Lingo / Director / Shockwave development for all occasions.

        (Over two millions lines of Lingo code served!)

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]

Reply via email to