A MouseEvent target that needs to end up in a displayobject variable… how would I pull that off
ie
private function skRollOver(e:MouseEvent):void {
e.target; // is a regular Object Why isn't it reporting back a displayobject?
}
A MouseEvent target that needs to end up in a displayobject variable… how would I pull that off
ie
private function skRollOver(e:MouseEvent):void {
e.target; // is a regular Object Why isn't it reporting back a displayobject?
}
e.target as DisplayObject;
?
DisplayObject (e.target);
Sorry guys, I think I phrased myself poorly. My question was more why the event.target returns an object when it should return a displayobject? :x
So, you have set up some mouse listener, your handler is called, and the MouseEvent instance’s target property is not of the type InteractiveObject? At least according to the documentation, it should always be an InteractiveObject, so it would seem that something is wrong, unless whatever is generating the event is user-created.
Do you think that you could post enough code that we could duplicate the situation?
Also, if for some reason you’re wondering why the property is typed as an object, then that’s just because the Event class defines that property, so it isn’t necessarily going to be a DisplayObject (although I don’t think that that’s what you’re asking).
:: Copyright KIRUPA 2024 //--