while (true)
{
final int firstByte = bitStream.readUI8();
if (firstByte == 0)
break;
final ButtonRecord record = new ButtonRecord();
record.setHasBlendMode((firstByte & 0x20) > 0);
record.setHasFilterList((firstByte & 0x10) > 0);
record.setStateHitTest((firstByte & 0x08) > 0);
record.setStateDown((firstByte & 0x04) > 0);
record.setStateOver((firstByte & 0x02) > 0);
record.setStateUp((firstByte & 0x01) > 0);
record.setCharacterID(bitStream.readUI16());
record.setPlaceDepth(bitStream.readUI16());
record.setPlaceMatrix(readMatrix());
if (type == TagType.DefineButton2)
{
record.setColorTransform(readColorTransformWithAlpha());
if (record.isHasFilterList())
{
final int count = bitStream.readUI8();
final Filter[] filterList = new Filter[count];
for (int i = 0; i < count; i++)
filterList[i] = readFilter();
record.setFilterList(filterList);
}
if (record.isHasBlendMode())
record.setBlendMode(bitStream.readUI8());
}
characters.add(record);
}
return characters.toArray(new ButtonRecord[characters.size()]);
}