Thank you very much. That works perfectly!
It wasn't clear to me that you had to call getBand() in order to get
to the event source.

Thanks again,

On Oct 6, 4:12 pm, Michael Nosal <[email protected]> wrote:
> The code below is the right direction.
>
> A couple of things:
> * This code will add events to your eventSource, not replace the  
> existing events. You'd need to call eventSource.clear() if you want to  
> blow away the old events.
> * You said "load a new XML file" but the code below is for json.  
> change 'json' to 'xml' and you're good (unless you really are loading  
> json).
> * You need to have a valid reference for eventSource in the inner  
> anonymous function. Try:
>
> function updateData(filename) {
>         var eventSource = tl.getBand(0).getEventSource();
>         Timeline.loadJSON(filename,
>            function(json, url) {eventSource.loadJSON(json,url); });
>         tl.layout();
>
> }
>
> Use the index of whichever band you want to load the data into in the  
> call to getBand.
> If your bands have different event sources, then you'd need to  
> call .loadJSON on each one separately.
>
> --Mike Nosal
>
> On Oct 6, 2009, at 10:25 AM, Paul Duggan wrote:
>
>
>
> > Hi,
>
> > First off, I'd just like to say how great Timeline is, really enjoying
> > working with it.
> > I have a a fairly simple question (I hope) about changing the data
> > source.
>
> > I've gone through the getting started tutorial here:
> >http://code.google.com/p/simile-widgets/wiki/Timeline_GettingStarted
> > I'd now like to add a Javascript function to change the data source.
> > E.g. load a new XML file and refresh the Timeline.
>
> > I've searched a lot and found references to paint(), and update() but
> > I can't work out how to use them.
>
> > Here is the simple sort of code I'm trying:
>
> > function updateData(filename) {
> >  Timeline.loadJSON(filename, function(json, url) {eventSource.loadJSON
> > (json, url); });
> >  tl.layout();
> > }
>
> > I'm sure someone can tell me what I'm doing wrong fairly quickly.
>
> > Many Thanks,
--~--~---------~--~----~------------~-------~--~----~
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