ruffle
ruffle copied to clipboard
First Frame Bug on Timer
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
Thank you so much for the detailed report & a test case!
*The original swf wasn't correct, I have updated the zip
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.
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:
1is never traced (it goes straight from20to2)- The green text that says "FIRST FRAME" is never visible
I think https://github.com/ruffle-rs/ruffle/issues/6144 could be related?