Skip to content

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

@skylogic004

Description

@skylogic004

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-avm1Area: AVM1 (ActionScript 1 & 2)bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions