This repository has been archived by the owner on May 15, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding embedded .abc (AVM+) bytecode tag
- Loading branch information
Simon Richardson
committed
Feb 3, 2012
1 parent
9ff62ce
commit 4298a71
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.codeazur.as3swf.tags | ||
{ | ||
import com.codeazur.as3swf.SWFData; | ||
|
||
import flash.utils.ByteArray; | ||
|
||
public class TagDoEmbeddedABC implements ITag | ||
{ | ||
public static const TYPE:uint = 72; | ||
|
||
protected var _bytes:ByteArray; | ||
|
||
public function TagDoEmbeddedABC() { | ||
_bytes = new ByteArray(); | ||
} | ||
|
||
public static function create(abcData:ByteArray = null):TagDoEmbeddedABC { | ||
var doABC:TagDoEmbeddedABC = new TagDoEmbeddedABC(); | ||
if (abcData != null && abcData.length > 0) { | ||
doABC.bytes.writeBytes(abcData); | ||
} | ||
return doABC; | ||
} | ||
|
||
public function get bytes():ByteArray { return _bytes; } | ||
|
||
public function parse(data:SWFData, length:uint, version:uint, async:Boolean = false):void { | ||
var pos:uint = data.position; | ||
data.readBytes(bytes, 0, length - (data.position - pos)); | ||
} | ||
|
||
public function publish(data:SWFData, version:uint):void { | ||
var body:SWFData = new SWFData(); | ||
if (_bytes.length > 0) { | ||
body.writeBytes(_bytes); | ||
} | ||
data.writeTagHeader(type, body.length); | ||
data.writeBytes(body); | ||
} | ||
|
||
public function get type():uint { return TYPE; } | ||
public function get name():String { return "DoABC"; } | ||
public function get version():uint { return 9; } | ||
public function get level():uint { return 1; } | ||
|
||
public function toString(indent:uint = 0):String { | ||
return Tag.toStringCommon(type, name, indent) + | ||
"Length: " + _bytes.length; | ||
} | ||
} | ||
} |