Translate

> > ByteArray to File Save

ByteArray to File Save

Posted on Tuesday, April 5, 2011 | No Comments

     //Global Variable
   private    var outputByte:ByteArray = new ByteArray();
        private    var file:File = new File();

// set this code where you want to call
{
            outputByte.writeUTFBytes(objectStr);
            file.addEventListener(Event.COMPLETE,saveDesignFile,false,0,true);
           // create a file with a dummy data
            file.save("ds","Saraku.skd");

}

// this code work for save
        private function saveDesignFile(event:Event):void
        {
            var fileWriteStream:FileStream = new FileStream();
            fileWriteStream.open(file,FileMode.WRITE);
            fileWriteStream.writeBytes(outputByte,0,outputByte.length);
            fileWriteStream.close();
        }

Leave a Reply

Powered by Blogger.