Javascript captures a screen shot of a flash object

basically what i want to do is:

I have a flash game on the page (e.g. pacman)

I want you to have a print screen of this game using javascript

Is it possible? I know that I can incorporate game swf into a narrower swf and capture a screenshot using flash, but I need this to be done in javascript. is it possible?

+3
source share
2 answers

If you control both the main page and the flash movie, you can create a screenshot in flash memory and just send it to javaScript, and then do everything you need with javaScript.

In ActionScript:

import flash.external.ExternalInterface;
ExternalInterface.call("showBase64Image", generateBase64Screenshot());
// see this Mario Klingenmann file for ideas how to do that http://www.quasimondo.com/archives/000572.php

And then in javaScript:

function showBase64Image(base64data) {
    var img = document.createElement('img');
    img.src = base64data;
    document.body.appendChild(img);
}

P.S. allowScriptAccess Flash, Flash- javaScript ( , Flash- ).

, - (, , -), , javaScript, / .

+3

Source: https://habr.com/ru/post/1770435/


All Articles