[mochikit] Re: Target() of asd seems wrong?

2006-02-21 Thread Thomas Hervé

target returns the element where event takes place, not the element
porting the event listener, so it's correct.

If I understand your problem, the best you can do is passing the
myObject as argument to the gotFlash method (hint: look at
Base.partial).


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Target() of asd seems wrong?

2006-02-21 Thread LukeStark

Hmm. I think I understand, but why then do I include MyObject in the
connect call? What is it's purpose if not to be available as the
target()? I'd like to attach any number of member data points to it
(since I know them at runtime) and have a generic gotFlash() that
references target().foo to get any arbitrary foo I may have assigned
to that particular object.

It allows me to create many possible objects that all call gotFlash
which can then follow back through for arguments.

Is there a clear example of how to pass arguments on DOM signals? My
real world example uses onclick as the signal, and I'm not sure how to
pass args other than the event itself.

Using partial doesn't help me (that I can see) since my goFlash is
shared, and I don't want to bind it to only one node.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Target() of asd seems wrong?

2006-02-21 Thread Thomas Hervé

 Hmm. I think I understand, but why then do I include MyObject in the
 connect call?

You include it because it's the way events work in Javascript :). You
don't have other choices.

 What is it's purpose if not to be available as the
 target()? I'd like to attach any number of member data points to it
 (since I know them at runtime) and have a generic gotFlash() that
 references target().foo to get any arbitrary foo I may have assigned
 to that particular object.

It's not the purpose of target, that's all (and the purpose of the
underlying values target/srcElement). If you want to do this, you have
to connect your function on a node without child (it's a possiblity,
even if it may not be the good choice).

 Using partial doesn't help me (that I can see) since my goFlash is
 shared, and I don't want to bind it to only one node.

I'd do it like this (not tested):

connect(myObject, 'onclick', partial(gotFlash, myObject));
connect(myObject2, 'onclick', partial(gotFlash, myObject2));

gotFlash = function (node, event) {
// blabla
};

-- 
Thomas


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Target() of asd seems wrong?

2006-02-21 Thread LukeStark

For the record (and my own pride) I figured it out before Thomas' How
To message. 

:P


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---