/// <summary> /// Creates a new <see cref="PlaceObject2Tag"/> instance. /// </summary> /// <param name="depth">Depth.</param> /// <param name="colorTransform">Color transform.</param> public PlaceObject2Tag(int depth, CXFormWithAlphaData colorTransform) { this.depth = (ushort)depth; this.colorTransform = colorTransform; this.placeFlagMove = true; _tagCode = (int)TagCodeEnum.PlaceObject2; }
/// <summary> /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see> /// </summary> public override void ReadData(byte version, BufferedBinaryReader binaryReader) { RecordHeader rh = new RecordHeader(); rh.ReadData(binaryReader); bool placeFlagHasClipActions = binaryReader.ReadBoolean(); bool placeFlagHasClipDepth = binaryReader.ReadBoolean(); bool placeFlagHasName = binaryReader.ReadBoolean(); bool placeFlagHasRatio = binaryReader.ReadBoolean(); bool placeFlagHasColorTransform = binaryReader.ReadBoolean(); bool placeFlagHasMatrix = binaryReader.ReadBoolean(); bool placeFlagHasCharacter = binaryReader.ReadBoolean(); placeFlagMove = binaryReader.ReadBoolean(); depth = binaryReader.ReadUInt16(); characterId = 0; if (placeFlagHasCharacter) { characterId = binaryReader.ReadUInt16(); } matrix = null; if (placeFlagHasMatrix) { matrix = new Matrix(); matrix.ReadData(binaryReader); } colorTransform = null; if (placeFlagHasColorTransform) { colorTransform = new CXFormWithAlphaData(); colorTransform.ReadData(binaryReader); } ratio = 0; if (placeFlagHasRatio) { ratio = binaryReader.ReadUInt16() / 65535.0f; } name = null; if (placeFlagHasName) { name = binaryReader.ReadString(); } clipDepth = 0; if (placeFlagHasClipDepth) { clipDepth = binaryReader.ReadUInt16(); } // get bytecode actions clipActions = null; if (placeFlagHasClipActions) { // different behaviour for Flash 6+ actionHead = (version >= 6) ? binaryReader.ReadBytes(6) : binaryReader.ReadBytes(4); // read clip action records to list ArrayList clpAc = new ArrayList(); //ClipActionRec a = null; bool res = true; do { ClipActionRec action = new ClipActionRec(); res = action.ReadData(binaryReader, version); if (res) { clpAc.Add(action); } }while (res); // copy list to array clipActions = new ClipActionRec[clpAc.Count]; clpAc.CopyTo(clipActions, 0); } }