Yes, you want to add the OnScrollListener to the band after the timeline has 
been created. 
You also have a trailing comma after the definition of the zone in the second 
HotZoneBandInfo:
...
magnify:5,
unit:Timeline.DateTime.YEAR}, ],

Trailing commas inside array definitions like this },]  cause Internet Explorer 
to choke and fail. Avoid them because they are very difficult to find by visual 
inspection, and cause IE to fail spectacularly without any sort of helpful 
error message.

--Mike

On Jun 23, 2011, at 6:15 PM, Jeff Roehl wrote:

>> Add a scroll listener to automatically update the hidden input anytime the 
>> user 
>> scrolls:
>> 
>> tl.getBand(0).addOnScrollListener(function(band) {
>>   var centerDate = band.getCenterVisibleDate();
>>   document.getElementById("center").value = centerDate.dateFormatAsString();
>> });
> 
> *****************************************************************************
> Where do I put the ScrollListener?
> 
> I have put it at the bottom of the onload function, per the following. Is 
> this 
> correct?
> *****************************************************************************
> 
> function onLoad(){ var bandInfos = [ Timeline.createHotZoneBandInfo({ zones: 
> [  
> { start: "Jan 02 1939 00:00:00 GMT-0500",    end: "Dec 31 1945 00:00:00 
> GMT-0500", magnify: 39,  unit:     Timeline.DateTime.MONTH},  { start: "Jan 
> 01 
> 1917 00:00:00 GMT-0500",    end: "Jan 01 1939 00:00:00 GMT-0500", magnify: 4, 
>  
> unit:     Timeline.DateTime.YEAR},  { start: "Apr 01 1945 00:00:00 GMT-0500", 
>    
> end: "May 01 1945 00:00:00 GMT-0500", magnify: 10,  unit:     
> Timeline.DateTime.WEEK}   ], eventSource: Y95CC1A21,  date: "Jan 01 1945 
> 00:00:00 GMT-0500", width: "90%", layout: "original", intervalUnit: 
> Timeline.DateTime.DECADE, intervalPixels: 180 }) ,  
> Timeline.createHotZoneBandInfo({ zones: [  { start: "Jan 01 1930 00:00:00 
> GMT-0500",    end: "Dec 29 1946 00:00:00 GMT-0500", magnify: 5,  unit:     
> Timeline.DateTime.YEAR},   ], eventSource: Y95CC1A21,  date: "Jan 01 1945 
> 00:00:00 GMT-0500", width: "10%", layout: "overview", intervalUnit: 
> Timeline.DateTime.DECADE, intervalPixels: 80 }) ]; bandInfos[1].syncWith = 0; 
> bandInfos[1].highlight = true;  tl = 
> Timeline.create(document.getElementById("timeline"), bandInfos); 
> Timeline.loadXML("xml/NUAAW0Z81.xml", function(xml, url) { 
> Y95CC1A21.loadXML(xml, url); }); }; 
> tl.getBand(0).addOnScrollListener(function(band) {    var centerDate = 
> band.getCenterVisibleDate();    document.getElementById("center").value = 
> centerDate.dateFormatAsString();      });
> 
> 
> Thanks 
> Jeff Roehl\

-- 
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