Testing for a View Using Event Property: source
Hey guys - Trying to test for a view using the event property source.
Passing the source object is wicked easy and working just fine, but testing for the object is not.
Example:
function testView(e) {
if (e.source == myView) {
// do stuff
}
// or
switch (e.source) {
case myView:
// do stuff
break;
default:
break;
}
}
myView.addEventListener("touchstart", testView);
Any ideas? This is pretty easy in other languages, since most display objects have a name property or you can just check the object itself.
Cheers!
1 Answer
-
Accepted Answer
Hi Fred - you ought to be able to attach a name attribute to a view and branch your code that way. Have you had a look at this example in the Kitchen Sink?