x


Pass Unity screenshot to Flash

Is this possible? I've been trying to pass as: byte[] bytes = screenShot.EncodeToPNG(); but Flash receives as CLIObject and if I try to use as ByteArray it returs as a null obj.

more ▼

asked Jun 29 '12 at 01:34 PM

christianpugliese gravatar image

christianpugliese
60 1 1 2

Could you add a few snippets of the code you're using so we can see what you're trying?

Jun 29 '12 at 02:32 PM Julien.Lynge
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

[solved] a friend just found an easy way of doing that.

var bmp:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, false); stage.stage3Ds[0].context3D.drawToBitmapData(bmp);

more ▼

answered Jun 29 '12 at 02:35 PM

christianpugliese gravatar image

christianpugliese
60 1 1 2

where do you call stage.stage3Ds[0].context3D.drawToBitmapData(bmp)? because it for me it gives "Error #3692: All buffers need to be cleared every frame before drawing", which means I'm not calling that function between render and present or something like that.

Jul 31 '12 at 12:01 PM Paulius Liekis

Found my problem: you need to use WaitForEndOfFrame. In my case I was using that, but calling something more (like Applicaiton.CaptureScreenshot) which, I guess, was conflicting with stage operations.

Jul 31 '12 at 01:02 PM Paulius Liekis

Hi,

Would you mind telling me how you achieved the "Taking screenshot" part, I can't manage to get it working on the Flash build (as far as I'm concerned, nor Application.CaptureScreenshot() nor Texture.ReadPixels() do work on this platform).

Thanks

Mar 04 at 09:15 AM Le nain

You need to use ActionScript function to capture screenshot into BitmapData as explained in this answer, once you have that you can transfer that BitmapData to Unity Texture.

Mar 04 at 04:34 PM Paulius Liekis

Yeah, thanks, I figured it out a bit after. I thought at first that this was just "passing the file from Unity to Flash", as the title suggested, as I know nothing about AS.

Mar 04 at 04:46 PM Le nain
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x269
x104

asked: Jun 29 '12 at 01:34 PM

Seen: 523 times

Last Updated: Mar 04 at 04:46 PM