# Saving Sprites or Shapes with ByteArray

**URL:** <https://forum.kirupa.com/t/saving-sprites-or-shapes-with-bytearray/226678>\
**Category:** flash\
**Created:** [May 23, 2007, 2:51am UTC](https://forum.kirupa.com/t/saving-sprites-or-shapes-with-bytearray/226678 "2007-05-23T02:51:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![obrigado](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/obrigado/32/3563_2.png) [@obrigado](https://forum.kirupa.com/u/obrigado)\
**Post date:** [May 23, 2007, 2:51am UTC](https://forum.kirupa.com/t/saving-sprites-or-shapes-with-bytearray/226678/1 "2007-05-23T02:51:33Z")

</div>

I’m trying to find a way to save vector drawing information made in a flash application in external files.

Basically, I have a simply vector drawing application - I want to put this on a server and have a way for users to “save” the graphics data on the server for later viewing.

I thought it would make sense to throw the “canvas” Shape object into binary format and then save it on the server via some external PHP.

The trouble is, I can’t seem to recover the Shape object from the binary data… it’s always “null.”

Here’s the idea:

```auto

var testClip:Shape = new Shape();
testClip.graphics.beginFill(0xFF0000);
testClip.graphics.drawRect(0,0,100,100);
testClip.graphics.endFill();
stage.addChild(testClip);

var byteClip:ByteArray = new ByteArray();
byteClip.writeObject(testClip);

byteClip.position = 0;
var newTestClip:Shape = byteClip.readObject as Shape;
stage.addChild(newTestClip);

```

Any ideas? I know saving bitmaps would be simple, but I’d like to keep things vector if possible.

Thanks!
