core: Children run an initial frame when changing button states

There was a one-frame-off flicker when a button changed states.
Now children will tick a frame so that they are properly created
immediately when the parent button changes state.
This commit is contained in:
Mike Welsh 2020-05-23 18:38:55 -07:00
parent 932ad30570
commit 993421e732
1 changed files with 2 additions and 5 deletions

View File

@ -247,6 +247,7 @@ impl<'gc> ButtonData<'gc> {
); );
child.set_depth(context.gc_context, record.depth.into()); child.set_depth(context.gc_context, record.depth.into());
child.post_instantiation(avm, context, child, None); child.post_instantiation(avm, context, child, None);
child.run_frame(avm, context);
self.children.insert(record.depth.into(), child); self.children.insert(record.depth.into(), child);
} }
} }
@ -394,12 +395,8 @@ impl<'gc> ButtonData<'gc> {
&& (action.condition != swf::ButtonActionCondition::KeyPress && (action.condition != swf::ButtonActionCondition::KeyPress
|| action.key_code == key_code) || action.key_code == key_code)
{ {
// KeyPress events are consumed when a button handles them.
if action.condition == swf::ButtonActionCondition::KeyPress {
handled = ClipEventResult::Handled;
}
// Note that AVM1 buttons run actions relative to their parent, not themselves. // Note that AVM1 buttons run actions relative to their parent, not themselves.
handled = ClipEventResult::Handled;
context.action_queue.queue_actions( context.action_queue.queue_actions(
parent, parent,
ActionType::Normal { ActionType::Normal {