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

AVM2: Manually fire late added/addedToStage events on root clips #7046

Merged
merged 1 commit into from
Jun 27, 2022

Conversation

kmeisthax
Copy link
Member

@kmeisthax kmeisthax commented May 21, 2022

AS3 display objects always get added and addedToStage events, even the root movie clip. We actually add the root clip before its constructor runs, so it will miss those events. This minor hack fixes that by checking if we just constructed the root clip and, if so, fires those events.

There are no tests because the only tests that revealed this behavior are part of #5876 and test other behaviors

@kmeisthax kmeisthax marked this pull request as ready for review May 21, 2022 19:09
@Herschel
Copy link
Member

Herschel commented Jun 2, 2022

Could these events be fired manually inside, say, Player after set_root_movie or the first run_frame, or similar?

@kmeisthax
Copy link
Member Author

We can't fire the events in set_root_movie because that's too early: objects are not initialized and thus cannot add event handlers to themselves until the frame construction step.

In #7048, I'm moving all of the AVM2 frame logic into a separate function, and we possibly could send the event there instead, right before we broadcast frameConstructed. The root just inherently knows if it needs to broadcast the event based on whether or not it constructed itself this frame, which is why I put the events there - we'd have to get this information into run_frame_avm2 somehow.

If you're wondering, these are the series of tests that need to get added/addedToStage events on the root in order to pass.

@Herschel
Copy link
Member

Thank you!

@Herschel Herschel merged commit 632052f into ruffle-rs:master Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants