core: Fix button action with multiple conditions not firing (fix #195)

If a button event had both a keyPress condition and another
condition:

on(release, keyPress "A") { }

these actions would not fire on click, because it would still
check if the key was down (which doesn't apply to clicks!)

Fixes #195.
This commit is contained in:
Mike Welsh 2019-12-22 15:52:40 -08:00
parent 9211c7ac05
commit 2f0963fa6c
1 changed files with 4 additions and 1 deletions

View File

@ -320,7 +320,10 @@ impl<'gc> ButtonData<'gc> {
) {
if let Some(parent) = self.base.parent {
for action in &self.static_data.read().actions {
if action.condition == condition && action.key_code == key_code {
if action.condition == condition
&& (action.condition != swf::ButtonActionCondition::KeyPress
|| action.key_code == key_code)
{
// Note that AVM1 buttons run actions relative to their parent, not themselves.
context.action_queue.queue_actions(
parent,