Skip to content

Old SWF file not running (AS2) #11322

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

Open
ErdincBARUT opened this issue May 31, 2023 · 4 comments
Open

Old SWF file not running (AS2) #11322

ErdincBARUT opened this issue May 31, 2023 · 4 comments
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working

Comments

@ErdincBARUT
Copy link

Describe the bug

Working on Flash Player not working on Ruffle DEMO page.
confeti.zip

Expected behavior

Not running.

Affected platform

Online demo

Operating system

Chrome

Browser

No response

Additional information

confeti.zip

@ErdincBARUT ErdincBARUT added the bug Something isn't working label May 31, 2023
@Lord-McSweeney Lord-McSweeney added the A-avm1 Area: AVM1 (ActionScript 1 & 2) label May 31, 2023
@Toad06
Copy link
Member

Toad06 commented Jun 1, 2023

Thank you for the report.

Ruffle doesn't return the expected value for this in the following line:
eval("this.caida_mc.conf" + confCount).serConfeti();

Replacing this with _root makes the file work in Ruffle (and still works in Flash Player). Here's the edited file.

eval("_root.caida_mc.conf" + confCount).serConfeti();


I made a minimal test that reproduces the issue (SWF available here):

this.createEmptyMovieClip("mc", 1);
this.mc.onEnterFrame = function() {
   trace(this); // "_level0.mc" in FP and Ruffle (note: P-code is "Push register1")
   var v = "";

   var a = eval("this" + v); // note: "Push 'this' GetVariable" would produce the same result
   trace(a); // "_level0" in FP, "[type Object]" in Ruffle
   trace(a == _global); // "false" in FP, "true" in Ruffle

   trace("");

   var a = eval("this.mc" + v);
   trace(a); // "_level0.mc" in FP, "undefined" in Ruffle

   delete this.onEnterFrame;
};

Note that before #7239, eval("this" + v) traced _level0.mc (which was also incorrect).

@moulins, as the author of #7239, I think you could have an idea of why this issue is happening.

@ErdincBARUT
Copy link
Author

Its not my codes, I tested old swf files and see this problem. I hope Ruffle development gone more faster to complete.
Thank you

@Toad06
Copy link
Member

Toad06 commented Jun 1, 2023

Thanks for reporting it, we'll do our best to fix the issue affecting the original file, so let's keep this bug report open.

@Toad06 Toad06 reopened this Jun 1, 2023
@moulins
Copy link
Contributor

moulins commented Jun 4, 2023

It seems that our logic for "inheriting" this when no this local exist is wrong: we pick the this value of the parent activation, which doesn't actually match the lexical scope if the function is executed via the MovieClip's timeline.

I think the "most correct" way of fixing this would to remove the this special case and put this on the scope chain like any other local variable.

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

No branches or pull requests

4 participants