avm1: Allow String for ActionGotoFrame2

This commit is contained in:
Mike Welsh 2019-08-15 18:00:53 -07:00
parent fe086c11ff
commit e890ad33e6
2 changed files with 7 additions and 6 deletions

View File

@ -557,11 +557,12 @@ impl Avm1 {
Value::Number(frame) => {
clip.goto_frame(scene_offset + (frame as u16) + 1, !set_playing)
}
Value::String(_frame_label) => {
unimplemented!()
//if let Some(frame) = clip.frame_label_to_number(&frame_label, context) {
// clip.goto_frame(scene_offset + frame, !set_playing)
//}
Value::String(frame_label) => {
if let Some(frame) = clip.frame_label_to_number(&frame_label) {
clip.goto_frame(scene_offset + frame, !set_playing)
} else {
log::warn!("ActionGotoFrame2 failed: Movie clip {} does not contain frame label '{}'", clip.id(), frame_label);
}
}
_ => return Err("Expected frame number or label".into()),
}

View File

@ -207,7 +207,7 @@ impl<'gc> MovieClip<'gc> {
self.variables.insert(var_name.to_owned(), value);
}
fn id(&self) -> CharacterId {
pub fn id(&self) -> CharacterId {
self.static_data.id
}