World Flights 2- calling remove(airline) immediately after add(airline) ?

11 views
Skip to first unread message

R. Daneel Olivaw

unread,
Oct 21, 2011, 1:49:45 AM10/21/11
to PhiloGL
Hello,

I love the animated flight paths in World Flights 2 -- thank you for
the upgrade! :)

I am trying to modify the code so that the paths disappear as soon as
they are complete, but I'm not sure where I would place the call to
airlineMgr.remove to do this. I have tried the below (in index.js),
using setTimeout, but it causes the paths to be removed too quickly.
There must be a better way to do this, but I am not yet familiar
enough with the code, or how the behaviors are wired in JS. Any
suggestions?

Thanks --

//when an airline is selected show all paths for that airline
airlineList.addEventListener('change', function(e) {
var target = e.target,
airlineId = target.id.split('-')[1];

function callback() {
if (target.checked) {
airlineMgr.add(airlineId);
centerAirline(airlineId);
setTimeout(airlineMgr.remove(airlineId),50000);
} else {
airlineMgr.remove(airlineId);
}
}

R. Daneel Olivaw

unread,
Oct 21, 2011, 2:02:14 AM10/21/11
to PhiloGL
to clarify -- the behavior I am trying to achieve is: checking the
checkbox for an airline will draw the routes, and then after a pause,
erase them (without un-checking the airline).

Nicolas Garcia Belmonte

unread,
Oct 26, 2011, 2:07:40 PM10/26/11
to phi...@googlegroups.com
Hi - You should wrap your function call into a function:

setTimeout(function() { airlineMgr.remove(airlineId) }, 50000);

--
Nicolas Garcia Belmonte - http://philogb.github.com/

Reply all
Reply to author
Forward
0 new messages