never mind, newbie error... Another question so:
Text element declared in createView:
this.controls.qTxt = new KONtx.element.Text({...}).appendTo(this);
and passed as reference to timer:
var myTimer = KONtx.utility.timer.setInterval(this._timerFired, 6000,this.controls.qTxt);
Callback function as follow:
_timerFired: function(TextControl) {
TextControl.setText("random text");
}
error in terminal:
WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WE 00:00:26:865: [T:8137] ERROR!ERROR!ERROR!ERROR!ERROR!
WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WE 00:00:26:865: [T:8137] HelloWorld [com.kgb.widgets.tv.helloworld]
WE 00:00:26:865: [T:8137] TypeError: TextControl.setText is not a function (sidebar.js: Line 156)
WE 00:00:26:865: [T:8137] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
When i print TextControl it shows up as [object DOMEvent]
What am i doing wrong?
Thanks
You can't pass in an arbitrary argument like that. The argument TextControl in the callback is an event object, not the Text object.
I don't use timers much, but can you just refer to the this.controls.qTxt in the callback? I'm not sure what scope the callback executes in.