Skip to content
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

First Frame Bug on Timer #1706

Open
molleindustria opened this issue Nov 25, 2020 · 5 comments
Open

First Frame Bug on Timer #1706

molleindustria opened this issue Nov 25, 2020 · 5 comments
Labels
A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working

Comments

@molleindustria
Copy link

molleindustria commented Nov 25, 2020

Hello everybody, thank you for the great work!

I'm encountering a game breaking bug that I was able to reproduce.

Given a movieclip "clippy" and an interval that calls a gotoAndPlay(1) on it every x seconds as shown in the as2 code below:

clippy.onEnterFrame = function()
{ 
	trace(this._currentframe);
	
	if(this._currentframe==1)
	{
	trace("this doesn't fire");
	}

}


myInterval = setInterval(intervalFunction, 2000);

function intervalFunction ()
{
	clippy.gotoAndPlay(1);
}

In the Ruffle emulation, at the interval the first onEnterFrame event is skipped and the condition is never true, even though the first frame is visualized.

The correct Flash behavior would be to fire onEnterFrame on all frames. I'm guessing it has something to do with the interval functions being called after the onEnterFrame events.

Due to common -and awful- programming patterns in Flash, ie putting code in the first frame of a movieclip, this inconsistency can have a major impact on the application logic.

I wish I could help directly but Rust is still a mystery to me.

Attaching an example .fla and .swf
firstFrameBug.zip

@Dinnerbone Dinnerbone added A-avm1 Area: AVM1 (ActionScript 1 & 2) bug Something isn't working labels Nov 25, 2020
@Dinnerbone
Copy link
Contributor

Thank you so much for the detailed report & a test case!

@molleindustria
Copy link
Author

*The original swf wasn't correct, I have updated the zip

@molleindustria
Copy link
Author

Any updates on this bug? I'm receiving daily messages of people trying to play one of my games and getting stuck due to this frame skip.

*I don't even have an emulated version of the game on my site, the complains are coming from people who play it on old flash portals (beyond my control) which now run on ruffle.

@n0samu
Copy link
Member

n0samu commented Sep 13, 2022

Just posting the actual onEnterFrame function from the SWF since I was a bit confused at first:

clippy.onEnterFrame = function()
{
   trace(this._currentframe);
   if(this._currentframe == 1)
   {
      message._visible = true;
   }
   else
   {
      message._visible = false;
   }
};

The problems observed in Ruffle are:

  • 1 is never traced (it goes straight from 20 to 2)
  • The green text that says "FIRST FRAME" is never visible

@torokati44
Copy link
Member

I think #6144 could be related?

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