Hi all,
I’ve encountered a pretty frustrating issue and was hoping for some guidance.
Basically, I’m taking a a screenshot of a section of the stage using a bitmap and a matrix which I then encode into a bytearray using the PNGEncoder; in order is to serialize the bitmap image.
Next I’m saving the serialized bitmap image to a SharedObject variable.
The intention is to reload the bitmap image stored in the Shared Object variable in a different movieclip; however I keep getting an error 1034 and I’m sure I’m not doing this correctly so would very much appreciate some help with how to go about coding this.
Below is the code I have currently for saving the bitmap using the matrix, encoding using the byte array and saving into a shared object:
private function export():void
{
var bmd:BitmapData = new BitmapData(board.width, board.height);//Creates a new BitmapData with the board size
var myMatrix:Matrix = new Matrix();
var translateMatrix:Matrix = new Matrix();
translateMatrix.translate(-180, -72);//x and y coordinates for board section of stage
//alter values to shift matrix by that pixel
myMatrix.concat(translateMatrix);//store the matrix translation into myMatrix variable
bmd.draw(stage, myMatrix);//Draws the stage using the matrix translation
var ba:ByteArray = PNGEncoder.encode(bmd); //Creates a ByteArray of the BitmapData, encoded as PNG
var my_so:SharedObject = SharedObject.getLocal ("firstPage");//create shardobject called firstPage
my_so.data.image = bmd;//insert the encoded serialised Bitmap (bmd) into the shared object
my_so.flush();//save the shared object
MovieClip(parent).gotoReview(); //tells the application to go to the next screen (different movieclip)
How would I go about loading the image from the shared Object and ByteArray in the new Movieclip?
Many thanks in advance =)