Hi Mark,

In my use of Timeline, I wanted to do the same as you. I think there's a couple 
of ways:
1) (Assuming that you're using Original Painter) -- check out the functions in 
Original Painter that add listeners to the tape, label and icon divs. You can 
substitute your own listeners or change the function that the listeners call.

What you didn't say in your email is whether you also want the bubble to be 
shown or if you want the js to be called instead of the bubble being shown.

2) If you want the bubble to be shown, but want something else to happen also, 
you could use the function that creates the interior of the bubble. Override 
Timeline.DefaultEventSource.Event.prototype.fillInfoBubble
-- The original is in sources.js. 
The function is called with this set to the event object. So 
this.getDescription() will return the description. You may already be modifying 
this function if you are creating custom bubble contents.

3) One of the changes in 2.3 (the current trunk version) is that I've added 
unique id's to the event divs drawn on the Timeline by the painter. The idea is 
that you can easily translate from the div's id to the right event object.

In my own projects, I've used this feature to implement a single listener (per 
band) that can act when there's a mouse click on an event's tape, label, or 
icon. The issue is that what you do NOT want to do is to add anymore per-event 
listeners since a large number of listeners can really slow things down.

Hope this helps,

Larry







________________________________
From: Mark <[email protected]>
To: SIMILE Widgets <[email protected]>
Sent: Monday, February 16, 2009 8:51:06 AM
Subject: How do I call a Javascript function when I click on an event?


Hi,

I would like to add fire a Javascript function when I click on an
event (which currently shows the bubble).

I also need to pass across the description within the bubble itself.

Can somebody help me or point me in the right direction?

I'm using 2.2.0 installed locally on my server.

Thanks
Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to