AS3 ByteArray with multiple parts

I am thinking of distributing SWF bytes to multiple files, how can I put a set of bytes in different parts into one byte array?

eg:

var bytesPartOne:ByteArray;
var bytesPartTwo:ByteArray;
var bytesPartThree:ByteArray;
var bytesPartFour:ByteArray;

In one byte array?

var totalBytes:ByteArray;

Will reading partial bytes into a byte array also?

+3
source share
1 answer

In one byte array?

var totalBytes:ByteArray = new ByteArray;
totalBytes.writeBytes(bytesPartOne);
totalBytes.writeBytes(bytesPartTwo);
totalBytes.writeBytes(bytesPartThree);
totalBytes.writeBytes(bytesPartFour);

Note. Make sure bytesPartOne / two / Three / Four have a position set to zero (can be done byBatPartOne.position = 0, ...)

Will reading partial bytes into a byte array also?

What do you mean partial bytes?

+5
source

All Articles