core: Fix AVM2 buttons getting constructed with the wrong initial state.

This code was always wrong; and only saved from breaking by other wrong code elsewhere. Specifically:

 * `SimpleButton.construct_frame` sets the wrong initial state
 * but `MovieClip.instantiate_child` fires frame events before `post_instantiation`
  * and `SimpleButton.post_instantiation` sets the correct state
This commit is contained in:
David Wendt 2022-12-27 19:19:00 -05:00 committed by kmeisthax
parent eb0eede07d
commit cbf2e94aba
1 changed files with 1 additions and 3 deletions

View File

@ -425,8 +425,6 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
if run_frame { if run_frame {
self.run_frame_avm2(context); self.run_frame_avm2(context);
} }
self.set_state(context, ButtonState::Up);
} }
fn enter_frame(&self, context: &mut UpdateContext<'_, 'gc, '_>) { fn enter_frame(&self, context: &mut UpdateContext<'_, 'gc, '_>) {
@ -547,7 +545,7 @@ impl<'gc> TDisplayObject<'gc> for Avm2Button<'gc> {
self.frame_constructed(context); self.frame_constructed(context);
self.set_state(context, ButtonState::Over); self.set_state(context, ButtonState::Up);
//NOTE: Yes, we do have to run these in a different order from the //NOTE: Yes, we do have to run these in a different order from the
//regular run_frame method. //regular run_frame method.