ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.62k stars 809 forks source link

Support all Flash embed/object attributes #4258

Open Herschel opened 3 years ago

Herschel commented 3 years ago

This is a tracking issue for supporting the attributes that could be placed on the Flash embed/object tag: https://helpx.adobe.com/flash/kb/flash-object-embed-tag-attributes.html

The polyfill should honor these settings. They can be passed along to the Ruffle core via the config block, which also allows the JS API to use them.

In somewhat order of importance:

ousia commented 3 years ago

@Herschel, as for AS2, menu might be already implemented.

I mean, https://www.mejorar-presentaciones.tk/mejorar-presentaciones-loader.swf contains (besides a new ContextMenuItem()):

new_context = new ContextMenu();
new_context.hideBuiltInItems();

Thanks to the work of @adrian17 with #4173, the last standard context menu items (“Enter fullscreen” and “About Ruffle…”) are displayed, besides the new ContextMenuItem().

Flash player also removes the playing context menu items when .hideBuiltInItems() is invoked, but leaves “Settings…”, “Global settings…” and “About Adobe Flash Player…”.

Many thanks for your excellent work.

adrian17 commented 3 years ago

I think the point was about frontend (DOM) API, not AS; I didn't add menu support to the embed API.

ousia commented 3 years ago

Sorry, in that case I totally missed the point.

danielhjacobs commented 3 years ago

For menu="0", my personal preference as a user would be for the full screen button to still be available even when there are no other menu items, as it's useful on my animations but Forward/Reverse/Play don't work right. As the developers Ruffle may prefer to still have the About Ruffle button too. So my preferred version of that polyfill setting would be to have the old context menu back, but others may have different preferences.

n0samu commented 1 year ago

I just experimented a bit with the align attribute - it seems to match what's described here. Here is an example:

<div style="width: 1000px; height: 1000px;">
    Hello world
    <object type="application/x-shockwave-flash" data="ruffle-logo.swf" align="middle" width="640" height="480"><param name="allowscriptaccess" value="always"><param name="movie" value="ruffle-logo.swf"></object>
    Hello again
</div>

Here is the result: image

And here is the result of using align="right" instead: image

I also tested values of l, t, and r since this Adobe documentation implied that it should work. It did not, and it doesn't match what the Flash editor generates either. You can choose the align value via the "HTML alignment" in the Publish Settings: image

n0samu commented 1 year ago

I just tested the behavior of the browserZoom attribute, and it is very strange. At first I thought it didn't do anything because I didn't see any change when I added it to my Flash embed from above. But then I found this page:

Updated the embed code to prevent display bugs in Flash Player caused by a browser zoom level other than the default 100%.

  • More technically, added a param tag named "browserzoom" with value "noscale" which disables browser zoom on the game.
  • This now also applies to all embed codes on the website, for all versions of the game.

And indeed, zooming in and out of the game page with Flash Player enabled does not scale the Flash content. After a lot more experimenting, here's what I found: