>So, how far off am I to what you wanted to know?
Close, especially considering that I didn't do a very good job of clearly
expressing my question(s)...probably because of some confusion.
I think the problem is that I didn't/don't understand when things are
being called and/or triggered by DynAPI.
For example:
File A:
anObj= new myObject();
.....other stuff
DynAPI.document.addChild(anObj);
---------
File B:
function myObject()
{
this.field1=null;this.field2=null;
var l = new EventListener(this);
l.oncreate = function(e)
{var o = e.getTarget();}
}
I understand most of what was answered in previous emails (that
EventListener is creating an EventListener and assigning it to 'l', and that
the anonymous function is being assigned to the .oncreate property of l)
What was confusing, I think, to me was *when* oncreate was being called
(and by whom). When File A created an instance of a myObject I assumed that
oncreate was being called. I now realize that was incorrect.
It looks like (based on a liberal sprinkling of debugging statements)
oncreate is being called somewhere inside the addChild(anObj) execution.
So the way I'm currently thinking of it (and this may *still* be
confused...so please correct me/add to the info if possible) is that the
above code will
1. Create an instance of myObject called anObj.
2. Part of this object is an EventListener
3. somehow/somewhere the oncreate() function of the event listener is
called inside of DynAPI.document.addChild()
4. That call of oncreate is passing a reference of the event 'e' that
triggered the 'oncreate' call.
5. e.getTarget() returns the object that triggered it all in the
beginning.
3,4,5 are still pretty speculative since I didn't see code doing that
specifically.
But the addChild() must be triggering the oncreate event somehow, but I'm
not sure how/why.
You could have multiple Event listeners with a single object, certainly.
If you did an addChild() I guess it seems that an event is firing (perhaps
of a type that is a creation event) and so all the EventListeners that are
associated with the object (only 'l' in this case) execute their oncreate
function.
I think what was confusing me was that when you create an instance of the
object you're not really triggering the oncreate() function. That seems to
happen when you do Dynapi.document.addChild().
Is this roughly correct?
Thanks, by the way, for the discussion/help.
Cheers,
James
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help