We believe that the snapshot application of flex will not be unfamiliar, this example is based on this function. Why use AS3 watermark instead of background language, mainly client processing efficiency, and we can also use AS3 rich image API. So why not just add the watermark and then snapshot it? Mainly because the main interface requirements neat, so had to output the byte stream data only secretly add watermark.
Click here to see the effect of this instance, Click here Download the source code for this instance.
In this example, we first create a new canvas container that designates the source of the container's image control as the bitmap obtained by the first snapshot, and adds a label control to the canvas container when the Save Snapshot button is pressed. Then snapshot the canvas container and use the Pngencoder image encoder to encode the BitmapData object as a bytearray in PNG format, and finally upload the byte stream data to the background to generate the PNG picture and download it to the client. This technique is not difficult, the key is to take a client snapshot two times, remember that canvas is just a container for temporarily placing byte stream data. There is the use of two times calllater, please feel good.