Skip to content

Commit

Permalink
core: Add possibility to set tab_enabled in AVM1
Browse files Browse the repository at this point in the history
This makes it possible to set it from the debug UI.
  • Loading branch information
kjarosh authored and Dinnerbone committed May 13, 2024
1 parent 0c3ab81 commit f713c90
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions core/src/display_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2487,6 +2487,22 @@ pub trait TDisplayObject<'gc>:
false
}
}

fn set_avm1_property(
self,
context: &mut UpdateContext<'_, 'gc>,
name: &'static str,
value: Avm1Value<'gc>,
) {
if let Avm1Value::Object(object) = self.object() {
let mut activation = Activation::from_nothing(
context.reborrow(),
Avm1ActivationIdentifier::root("[AVM1 Property Set]"),
self.avm1_root(),
);
let _ = object.set(name, value, &mut activation);
}
}
}

pub enum DisplayObjectPtr {}
Expand Down
3 changes: 2 additions & 1 deletion core/src/display_object/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ pub trait TInteractiveObject<'gc>:
if context.swf.is_action_script_3() {
self.raw_interactive_mut(context.gc()).tab_enabled = Some(value)
} else {
tracing::warn!("Trying to set tab_enabled on an AVM1 object, this has no effect")
self.as_displayobject()
.set_avm1_property(context, "tabEnabled", value.into());
}
}

Expand Down

0 comments on commit f713c90

Please sign in to comment.