-
-
Notifications
You must be signed in to change notification settings - Fork 829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
avm1: Correct MovieClipLoader
methods
#6004
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
let target = match target { | ||
Value::String(_) => { | ||
let start_clip = activation.target_clip_or_root()?; | ||
activation.resolve_target_display_object(start_clip, *target, true)? | ||
} | ||
Value::Number(level_id) => { | ||
// Levels are rounded down. | ||
// TODO: What happens with negative levels? | ||
Some(activation.resolve_level(*level_id as i32)) | ||
} | ||
Value::Object(object) => object.as_display_object(), | ||
_ => None, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extract this logic into a fn since it's used by several of the methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, they have subtle differences:
load_clip
usesresolve_level
.unload_clip
andget_progress
usechild_by_depth
get_progress
returnsundefined
for non-DisplayObject objects.
It might be possible, but I doubt how better it will be.
Handle strings, numbers and DisplayObject targets (not just MovieClips). To support non-MovieClip targets, turn `clip.as_movie_clip().unwrap()` to `if let Some(mc) = clip.as_movie_clip()` in `Loader`.
Handle strings, numbers and DisplayObject targets.
Handle strings, numbers and DisplayObject targets. Return compressed length rather than uncompressed length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Fixes #917.