Hi everyone,
I am totaly new with Simile and I am trying to find the best way to
add/remove events from the time line on runtime.
In the API I didnt find remove&add methods but looking at the source
code, I can try and do something similar to what is done in the
LoadXml/loadJson methods.
"add" will look something like this:
function addDummyEvent(){
var event ={'start': 'May 28 2006 09:00:00 GMT',
'end': 'Jun 15 2006 09:00:00 GMT',
'title': 'added event',
'description': 'added event',
'image': 'http://imagecache2.allposters.com/images/BRGPOD/
102770_b.jpg',
'link': 'http://www.allposters.com/-sp/Portrait-of-Horace-
Brodsky-Posters_i1584413_.htm'
}
var url = '.';
var dateTimeFormat = null;
var base = eventSource._getBaseURL(url);
var parseDateTimeFunction = eventSource._events.getUnit().getParser
(dateTimeFormat);
var evt = new Timeline.DefaultEventSource.Event({
id: ("id" in event) ? event.id : undefined,
start: parseDateTimeFunction(event.start),
end: parseDateTimeFunction(event.end),
latestStart: parseDateTimeFunction
(event.latestStart),
earliestEnd: parseDateTimeFunction
(event.earliestEnd),
instant: event.isDuration || false,
text: event.title,
description: event.description,
image: eventSource._resolveRelativeURL
(event.image, base),
link: eventSource._resolveRelativeURL
(event.link, base),
icon: eventSource._resolveRelativeURL
(event.icon, base),
color: event.color,
textColor: event.textColor,
hoverText: event.hoverText,
classname: event.classname,
tapeImage: event.tapeImage,
tapeRepeat: event.tapeRepeat,
caption: event.caption,
eventID: event.eventID
});
Timeline.DefaultEventSource.prototype.add.call(eventSource,evt);
tl.layout();
debugger;
}
and I guess I can do something like this for removal (assuming I add
eventId):
function removeEvent(id){
eventSource._events.remove(id);
};
Note: the eventSource source used in the methods above is a global
variavle in which I store my eventsource.
Do you think these methods are ok?, any other suggestions?
Thanks
Ora
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---