Skip to content

AVM2: HitTestObject with SimpleButton not working #8722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
CUB3D opened this issue Dec 8, 2022 · 2 comments
Closed

AVM2: HitTestObject with SimpleButton not working #8722

CUB3D opened this issue Dec 8, 2022 · 2 comments
Labels
A-avm2 Area: AVM2 (ActionScript 3) bug Something isn't working hitTest Issues involving mouse picking and hitTest

Comments

@CUB3D
Copy link
Contributor

CUB3D commented Dec 8, 2022

Describe the bug

As shown by the attached sample, trying to perform a hitTestObject, where one value is a SimpleButton always fails.

Adding some additional logging around the current hit test logic, shows that the bounds of the button are always
BoundingBox { x_min: Twips(0), y_min: Twips(0), x_max: Twips(0), y_max: Twips(0), valid: false }

This causes an issue in Upgrade Complete!, where neither the Play button, nor the Back button in the Ship Builder work. This also might be the cause of the issue that prevents collecting money.

(In this SWF, click to move the green clip)
UGC Bug.zip

Expected behavior

hitTestObject behavior matches Flash Player

Affected platform

Desktop app

Operating system

Linux

Browser

No response

Additional information

No response

@CUB3D CUB3D added the bug Something isn't working label Dec 8, 2022
@n0samu n0samu added A-avm2 Area: AVM2 (ActionScript 3) hitTest Issues involving mouse picking and hitTest labels Dec 8, 2022
@CUB3D
Copy link
Contributor Author

CUB3D commented Dec 9, 2022

After playing about with this for a while, I think I've found a solution to this issue, currently the bounds of SimpleButton are taken as empty here.

Changing this to

BoundingBox {
    x_max: Twips::ZERO,
    y_max: Twips::ZERO,
    x_min: Twips::ZERO,
    y_min: Twips::ZERO,
    valid: true,
}

Makes the button clickable (somewhat, the mouse seems offset but I doubt that is related). This also fixes the issue in the linked swf.

@n0samu
Copy link
Member

n0samu commented Dec 27, 2022

Fixed by #8744

@n0samu n0samu closed this as completed Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm2 Area: AVM2 (ActionScript 3) bug Something isn't working hitTest Issues involving mouse picking and hitTest
Projects
None yet
Development

No branches or pull requests

2 participants