I have three classes: A, B, C. class A dispatches a event, class B will handle this and then dispatch it C. However, I got this weird type casting error in B's dispatchEvent function, which looks like follows:
public function handler(event:SomeEvent):void {
removeEventListeners();
dispatchEvent(event);
}
If I change it to the following, then I don't get any error:
public function handler(event:SomeEvent):void {
removeEventListeners();
var newEvent:SomeEvent = event.clone(); //create a clone of itself
dispatchEvent(newEvent);
}
Can anyone help me on this? Thank you.