Skip to content

[AS1] Reference to MovieClip is incorrect in Ruffle when MC removed #9257

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
skylogic004 opened this issue Jan 22, 2023 · 1 comment · Fixed by #9447
Closed

[AS1] Reference to MovieClip is incorrect in Ruffle when MC removed #9257

skylogic004 opened this issue Jan 22, 2023 · 1 comment · Fixed by #9447
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working

Comments

@skylogic004
Copy link

Describe the bug

I have found a scenario where Flash Player and Ruffle differ. I have produced a MWE here demonstrating the issue.

I first encountered this bug with my game, Zeta Flow. When a laser weapon is destroyed, the red laser that shoots out is also supposed to be removed. (in Flash it is removed; in Ruffle it remains).

This uses:

  • Flash version 6 (Flash MX)
  • Action Script 1

I tested desktop, self-hosted web, and CDN web versions of Ruffle (on Windows 10). I believe all versions of Ruffle affected.

I narrowed down the problem to a reference to a movie clip that doesn't get cleared when the movie clip is removed. In the MWE below, just follow the steps to reproduce the problem.

Online demo: https://tmp.skylogic.ca/ruffle_MWE/
SWF: https://tmp.skylogic.ca/ruffle_MWE/MWE.swf
FLA: https://tmp.skylogic.ca/ruffle_MWE/MWE.fla

My game (Zeta Flow) relies on this behavior. The laser is supposed to remove itself when the gun is destroyed. In hindsight (15 years later), I could have programmed this differently (and more efficiently) to avoid this. Maybe I'll go and change the code now in order to fix the game! But nonetheless, this highlights a difference in behavior.

Expected behavior

The code boils down to this:

_root.attachMovie("gun", "gun", 0);
_root.attachMovie("laser", "laser", 1);
_root["laser"].gun_reference = _root["gun"];
_root["gun"].removeMovieClip();

In Flash Player, "gun_reference" is correctly empty, but in Ruffle it lives on.

Flash Player:

_root["gun"] =
_root["laser"].gun_reference =

Ruffle:

_root["gun"] =
_root["laser"].gun_reference = _level0.gun

Affected platform

Desktop app

Operating system

Windows 10

Browser

Chrome Version 108.0.5359.126

Additional information

After writing this I looked at some other open issues, and now I'm realizing this issue may be the same as the one identified here and may possibly be resolved by #5492.

I'll post this issue anyway in case it provides a useful test case.

@skylogic004 skylogic004 added the bug Something isn't working label Jan 22, 2023
@n0samu n0samu added the A-avm1 Area: AVM1 (ActionScript 1 & 2) label Jan 22, 2023
@skylogic004
Copy link
Author

I have confirmed that #9447 does indeed fix this problem in my game!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants