I've been trying to store a Graph in our oracle db for the past few days.

Here's where I've gotten without using AMFPHP, or WebOrb (hoping it's
not necessary because the docs aren't helpful enough for what I want
to accomplish)

private function saveGraph():void
{
        graph1 = this.graph;
        var bytes:ByteArray = new ByteArray();
        bytes.writeObject(graph1);
        var request:URLRequest = new URLRequest ( scripts/storeGraph.php' );
        var loader: URLLoader = new URLLoader();
        request.contentType = 'application/octet-stream';
        request.method = URLRequestMethod.POST;
        request.data = bytes;
        loader.load( request );
}

I then push that byte array into a BLOB in my database.

Now I want to retrieve it and turn the byte array back into a Graph.
I've tried this:

<mx:HTTPService id = "load_graph" showBusyCursor="true"
resultFormat="object" result="storeGraph(event)"
url="scripts/storeGraph.php"/>

private function storeGraph(event:ResultEvent):void
{
     var temp:ByteArray = (event.result.graph) as ByteArray;
     var graph1:Graph = temp.readObject() as Graph;
}

Any help would be greatly appreciated. Is it just the resultFormat
that needs to change?  Is it in the PHP that needs to transform the
ByteArray into something else before sending it back to Flex?



Reply via email to