I think onDelMessage( dt) is bugged, should be changed to:
PHP Code:
for (i=this.destroylist.size()-1; i>=0; i--)
this.msgs.delete(this.destroylist[i]);
Otherwise you delete the wrong indices. In my opinion the whole deletion stuff should be made simplier though, e.g. remember in this.msgs the abolute time until the message should exist (timevar2 + time) and put the deletion stuff into onTimeout() or similar (if you don't want a timeout then use scheduleevent which is calling scheduleevent again until all messages are vanished)