tags:

views:

7

answers:

0

[Bindable] private var encodedData:String = ""; [Bindable] private var _id:String = ""; private var imgSnap:ImageSnapshot;

private function takeSnapshot(target:UIComponent,id:String):void{

    _id         = id;

    imgSnap             = ImageSnapshot.captureImage(target);
    encodedData         = ImageSnapshot.encodeImageAsBase64(imgSnap);
    Alert.show(_id.toString()+ " " + encodedData.toString());
    sendByteArray();

} private var _snapshotPath:String; private function sendByteArray():void{

    //Alert.show(_id.toString());
    var service:HTTPService = new HTTPService();
    service.url             = _snapshotPath;
    service.method          = 'POST';
    service.useProxy        = false;
    service.addEventListener(ResultEvent.RESULT,onResult);
    service.addEventListener(FaultEvent.FAULT,onFault);

    service.send({byteArray:encodedData,id:_id});
}

private function onResult(event:ResultEvent):void{

     ExternalInterface.call("sharePopup",event.result);

    //Alert.show(event.result.toString());
}

private function onFault(event:FaultEvent):void{

    Alert.show(event.message.toString());
}