ruffle-rs / ruffle

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

Reading external HTTP file fails (problem with either calling JavaScript function or SetVariable method) #4395

Open martinlnd opened 3 years ago

martinlnd commented 3 years ago

Ahoy again, dear Rufflers!

As mentioned in #4394 I have one more complicated issue to report:

On my most elaborate 2D/3D-animated website to date I read UTF-8 file

http://martinland.mur.at/acousmonuments/content/works/the_works.txt

which is being initiated in http://crop.mur.at/test/martinland/flash4acous1.gif

using

function loadList() {
  var flashMovie=getFlashMovieObject("noframe", "acous");
  readFileHttp(listURL, readLines, flashMovie);
  }

which in turn issues an HTTP "Get" request and then feeds the lines with

function readLines(text, movieHandle) {
  var splitText = text.split("\n");

  if(text.length) {
    for (i=0;i<splitText.length;i+=1) {
      movieHandle.SetVariable("/works:Line" +(i+1), splitText[i]);
      }
    }

  // we're done! signal it...
  movieHandle.SetVariable("/works:listSTATE", "READY");
  }

into the Flash object's numerous "Line" variables defined in the scope of "/works".

These lines are then parsed inside Flash, for example while displaying my hand-pixeled icons like in

http://crop.mur.at/test/martinland/flash4acous2.gif

Opening

http://martinland.mur.at/acousmonuments

and clicking on "Oeuvre" at the bottom should result in all this happening.

If the icons are running through and no text lines are displayed (like with Ruffle), something did go wrong.

I am not entirely sure yet if this fails on the JavaScript side of things (calling function "loadList()" from inside Flash for example, or when using the "SetVariable" method) or afterwards, while parsing is being done inside Flash (I don't think so); no serious debugging has been done yet because this has been working since 9 years up until now.

Maybe somebody with more insight into the project is able to comment below what the most likely reason might be? Thanks for that!

I also might be joining the effort for real if I feel up to it - let's make all this content last, no matter what greedy or short-sighted corporations are forcing upon us. This is a great project indeed!

sombraguerrero commented 3 years ago

This is primarily an instance of #3857 SetVariable should be fine within Flash, but the Ruffle player does not yet support any of Flash's traditional ExternalInterface/DOM integration methods or constructors. This is definitely on our to-do list though.

martinlnd commented 3 years ago

This is primarily an instance of #3857 This is definitely on our to-do list though.

Good to know, thanks ... this is the most complex issue I found so far. That being said - Ruffle is working great alREADY. I'll keep testing and supporting the project. <3

sombraguerrero commented 3 years ago

Although I doubt it would be sufficient for your more sophisticated content, you could always try to see how much you're able to accomplish with our Self-Host JS API as it currently is. It's fairly rudimentary compared to what Flash has, but people have been able to do quite a bit with it.

Ruffle JS API

martinlnd commented 3 years ago

Ruffle JS API

Ah, thanks sombraguerrero - might look into it.