Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionScript MouseEvent.clone() appears broken?

I have run into a problem attempting to redispatch mouse events in ActionScript 3, which I am admittedly a bit incredulous about. I have narrowed it down to the MouseEvent.clone() method appearing, well, completely broken. The following event handler:

    private function handleMouseMove( evt : MouseEvent ) : void
    {
        trace("mousemove", evt.stageX, evt.stageY);
        var newEvt : MouseEvent = evt.clone() as MouseEvent;
        trace("mousemoveclone", newEvt.stageX, newEvt.stageY);
    } 

Results in the following output, ad infinitum:

mousemove 167 206 
mousemoveclone 0 0

This matches what the code I was redispatching the MouseEvent to was receiving, hence my hypothesis of the broken clone function.

This is directly contradictory to what the linked documentation indicates should happen, unless I have missed something. I am at an entire loss as to what I did (or did not do) that could possibly cause this behavior. Did the AS3 guys really forget to read their own documents on Event.clone()?

I can work around this by instead using function objects for my specific use case, but I'd prefer not to. Any ideas?

Edit: The localX and localY members are being properly cloned it seems, which puts me at even more of a loss as to what is going on here.

like image 780
Not Sure Avatar asked Dec 05 '25 15:12

Not Sure


1 Answers

Thats a known bug. You can see the bug report here: http://bugs.adobe.com/jira/browse/FP-343

Everything else should get cloned though. You can always just assign stageX and stageY manually until the bug is fixed.

like image 118
Alex Jillard Avatar answered Dec 09 '25 16:12

Alex Jillard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!