swf to image on the website? - html

i want to convert a swf to image on my website. a user makes some changes on the stage and if he press a button "get image link", the swf stage will be converted to an image and its image link will appear within a box. like imageshack.. so user can use it in forums as image. how can i do this? i even dont know it is about flash or html...

Have a good read of Henry Jones - Using the AS3 Jpeg Encoder. He explains exactly what you need, plus some!
You basically what to use the BitmapData class to convert you displayobject into image data. Then you can use JPGEncoder from AS3 Core Lib, to encode that data into a JPEG. Then with a bit of serverside code you can send that JPEG to that server.

Related

How get a GIF from .SWF file with AS3 and Binary?

I have a SWF file that should display an animated image. This file contains pictures, a file ActionScript 3.0 and several Binary files.
My question is, how get a GIF of the result of this SWF file ?
Thanks in advance.
To make a GIF Image in Flash, go to Publish Settings in properties, and click the box next to GIF Image then click publish.
Also make sure that it works by uploading it online.
Hope this helps

Save picture of current screen to disk AS3

I want to add a button to my flash game (AS3) and on click it saves a picture of the current users whole screen and saves it to pictures/disk automatically, but I don't know how to do that, I know how to add the button to the UI and add a click event and all that, just need to know how to make it save a picture of the current screen to disk (doesn't have to be just the flash screen, can be the WHOLE screen of the users pc, either way works!)
I was on my way writing you the answer but I found this post have a better explaination: Is it possible to capture the screen and save the image in actionscript 3?
"Yes, it's possible.
Draw some display object to a BitmapData (the stage, for example) and crop it if neccesary (the second param of BitmapData::draw will help you out here).
Then, convert the raw pixel data to JPEG or PNG using some encoder. I'm sure up to this point, this is what those tutorials will explain you how to do.
Now, the third step is different but simple enough. Instead of sending the image data to a server side script, use a FileReference object. Since Flash Player 10, it has a method called save, that prompts the user to save a file locally.
Since this is a desktop app, you could also make it an AIR app. This will give more direct access to the file system and other features, in case you need them."

Check if uploaded image is CMYK in ActionScript 3.0

Is there any way to figure this out which user uploaded image in our flex project is RGB or CMYK?
Something like using byteArray and check the specific place of CMYK/RGB header on it...

Live Video Keying with Flash (AS3)? How to do that?

For a new project, I want to take a video feed, filmed in a greenscreen room, and as you see it, do a color keying, to kill the green and show an alternative picture on the background.
Is there a way to do this with Flash, AS3?
optional question: If a button is clicked, the now new constructed Picture should be saved as a Jpg. Any Idea?
Thanks a lot for you help!
For this sort of thing you're going to need to use Pixel Blender: http://www.adobe.com/devnet/pixelbender.html and possibly Alchemy as well http://labs.adobe.com/technologies/alchemy/
Sorry I can't give you more info than that as I've never worked with them before.
To capture a screen grab, it's easier. Create a new BitmapData object the size that you want your final image. Use the draw() method on it to capture the stage (or holding clip etc). Grab the as3corelib from here: https://github.com/mikechambers/as3corelib and use the JPGEncoder or PNGEncoder class to create a jpg or png (personally I prefer png, as even though the filesize is bigger, it's much quicker to generate as you don't need to worry about compression).
Then, use the FileReference class ( http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html) to save it out (JPGEncoder and PNGEncoder both return your image as a ByteArray so just pass that as the data to the FileReference.save() function).

Custom images for HTMLLoader

There is powerful HTMLLoader component for AIR wrapped in mx:HTML for Flex.
I want to supply images manually (ideally from bytes) for mx:HTML, which will display my generated content. The point is to pack all resources in the application without external files. I can pack different html pages in the app and switch them when mx:HTML dispatches Event.LOCATION_CHANGE. Now I want the same for images. What do you suggest?
Solved! Went through several stages:
Make HTMLLoader's background transparent with paintsDefaultBackground="false" and backgroundAlpha="0". Get notified of pictures location with javascript and draw them on HTMLLoader's graphics. This is complex and has problems with resizing (pictures get shifted), but was almost done...
Next idea - use <canvas> to draw images on them, sending data to javascript.
While reading canvas tutorials, stumbled upon data URI scheme, which does exactly what I needed in simplest possible way. Images are embedded in html page in base64 encoding.