html - Javascript take screenshot of flash object - Stack Overflow

basically what i want to do is this:I have a flash game on a page (pacman for example)I want to be able

basically what i want to do is this:

I have a flash game on a page (pacman for example)

I want to be able to take a print screen of that game using javascript

Is it possible? I know i can include the game swf in a nother swf and capture the screenshot using flash but i need it to be done in javascript. is this possible?

basically what i want to do is this:

I have a flash game on a page (pacman for example)

I want to be able to take a print screen of that game using javascript

Is it possible? I know i can include the game swf in a nother swf and capture the screenshot using flash but i need it to be done in javascript. is this possible?

Share Improve this question asked Oct 20, 2010 at 1:08 OzzyOzzy 10.7k28 gold badges98 silver badges140 bronze badges 2
  • Javascript cannot take a screen shot. – Prescott Commented Oct 20, 2010 at 1:37
  • Hello Ozzy, I am dealing with similar problem. You say it's possible to include swf in another swf. Can you point me to some example ? – Skuta Commented Jun 2, 2012 at 14:26
Add a ment  | 

2 Answers 2

Reset to default 3

If you control both the host page and the flash movie, then you can generate the screenshot in flash, and simply send it to javaScript, and then do whatever you need with it in javaScript.

In ActionScript:

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

And then in javaScript:

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

P.S. don't forget to allowScriptAccess for embedded Flash, to allow Flash movie to access the javaScript on your page (which is definitely not wise if the Flash movie is made by a 3rd party).

On the other hand, if you do not control the flash movie (for instance if you wanna make a website that'll host 3rd party Flash games) then you're out of luck, and what you need is not doable with javaScript alone, and it can only be achieved through use of browser plugins/extensions.

If it is your game and your website (in other words if you can modify both) try this:

http://danielmclaren/2008/03/use-javascript-to-take-a-screenshot-of-a-flash-movie

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745310471a4621971.html

相关推荐

  • html - Javascript take screenshot of flash object - Stack Overflow

    basically what i want to do is this:I have a flash game on a page (pacman for example)I want to be able

    5小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信