header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Srikanth
Points:0
Posts:0

5/19/2011 3:14:46 AM

Title: how to convert Byte Array to string.


Hello i record a microphone data into Byte array and then using binary socket(not XML socket) i send that data.
using the socket.writeBytes(byteArray) i can send the raw data successfully to destination but
i have to send the data with some more information.
so i thought of converting the byteArray to string then again append the required string to that converted string.
but when i do byteArray.toString() then data is not same.

if anyone knows how to change the byteArray to string please let me know.

thanx in advance



1
RedBull
Points: 930
Posts:0
5/20/2011 3:04:57 AM



to convert byteArray to string in flex or flash builder actionscript 3 you can use

//to convert byteArray to string
var myStr:String = byteArr.toString();

// convert string back into byteArray
var myByteArr:ByteArray= new ByteArray();
for(var i:int =0; i<myStr.length; i++)
{
myByteArr.writeByte( myStr.charCodeAt( i ) );
}

2
san
Points: 0
Posts:0
2/10/2012 4:32:22 AM



// convert string back into byteArray
var myByteArr:ByteArray= new ByteArray();
for(var i:int =0; i<myStr.length; i++)
{
myByteArr.writeByte( myStr.charCodeAt( i ) );
}

it is not working for me....


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 8+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions