Yes, the handler used for instantiating an object must be called
"new". This is because when you want to instantiate an object, you
call Director's "new" handler. Director's "new" handler figures out
what type of thing the user wants to create (e.g., new cast member,
new object, etc.). When it figures out that you want to create a
new object, Director allocates space in memory for the properties for
your new object by calling an internal Director handler called
"rawNew". Then, after allocating space for the properties, Director
calls the "new" handler in your parent script (remember in your call
to "new" you tell Director which script you are instantiating from)
and passes the address of the memory allocated for your parameters.
If you do not have a "new" handler in your script, it won't get
called and you will lose the opportunity to get back the object
reference:
on new me --
return me
end
The value of "me" is essentially the address in memory of where the
properties for this instance of the object are stored.
All this and more is detailed in excruciating detail in Chapter 6 of my book.
Irv
At 5:06 PM -0400 4/13/01, Dennis Flood wrote:
> > If you intend for this to be a parent script, make sure that you mark
>> it as a parent script. Otherwise (as others on this list have found
>
>Irv,
>
>I'm using it as a parent script, I hadn't really thought that creating
>objects out of movie scripts was possible before my accidental discovery.
>If you rename the new handler to something like "on create me", would there
>be any other difference??
>
>Thanks for the tip.
>
>Dennis
>
--
Lingo / Director / Shockwave development for all occasions.
(Home-made Lingo cooked up fresh every day just for you.)
[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!]