I need to pass ByteArray from Javascript function to Flex Actionscript function.
Have tried using the below JS:
function deviceResp(s){
var obj = document.getElementById('smera');
obj.deviceRespFx(s);
}
My AS function :
public function imageRespFxs(value:String):void{
Alert.show(value.length);
}
EDIT:
Callback Function is loaded on “creationComplete“
public function initDevice():void{
ExternalInterface.addCallback("deviceRespFx",imageRespFxs);
}
As the above method is inturn converting a byte array to a String so there is a loss of data, could any one please assist on how to pass a Byte Array from JS to AS function.
All thanks to Sam DeHaan,
Have finally managed to get it working with Base64 as hinted by Sam comments.
here is the peice of code might be helpful for others:
Firstly in my Java Code I convert the Image into Base64 String like this :
and I send this to FLex AS method and Decode the Same like this:
Thanks