FunctionCallNode superCall = new FunctionCallNode(LanguageIdentifierNode.buildSuper());
constructorContents.addItem(superCall);
// generate: initialWidth = $swfWidth;
LiteralNode widthNode = new NumericLiteralNode(Integer.toString(swfWidth));
BinaryOperatorNodeBase assignmentWidth = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("initialWidth"), widthNode);
constructorContents.addItem(assignmentWidth);
// generate: initialHeight = $swfHeight;
LiteralNode heightNode = new NumericLiteralNode(Integer.toString(swfHeight));
BinaryOperatorNodeBase assignmentHeight = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("initialHeight"), heightNode);
constructorContents.addItem(assignmentHeight);
classNodeMovieContents.addItem(constructorNode);
// build the movieClipData() getter
GetterNode movieClipDataGetterNode = new GetterNode(null, null, new IdentifierNode("movieClipData"));
movieClipDataGetterNode.addModifier(new ModifierNode(IASKeywordConstants.OVERRIDE));
movieClipDataGetterNode.setNamespace(new NamespaceIdentifierNode(INamespaceConstants.public_));
movieClipDataGetterNode.setType(null, new IdentifierNode("ByteArray"));
ScopedBlockNode movieClipDataContents = movieClipDataGetterNode.getScopedNode();
// generate: if (bytes == null)
ASToken compareToken = new ASToken(ASTokenTypes.TOKEN_OPERATOR_EQUAL, -1, -1, -1, -1, "==");
BinaryOperatorNodeBase nullCheck = BinaryOperatorNodeBase.create(compareToken, new IdentifierNode("bytes"), new LiteralNode(LiteralType.NULL, nullToken));
IfNode ifStmt = new IfNode(null);
ConditionalNode cNode = new ConditionalNode(null);
cNode.setConditionalExpression(nullCheck);
ifStmt.addBranch(cNode);
movieClipDataContents.addItem(ifStmt);
BlockNode ifContents = cNode.getContentsNode();
// generate: bytes = ByteArray(new $assetByteArray());
ASToken newToken = new ASToken(ASTokenTypes.TOKEN_KEYWORD_NEW, -1, -1, -1, -1, IASKeywordConstants.NEW);
FunctionCallNode newBytes = new FunctionCallNode(newToken, new IdentifierNode(byteArrayClassName));
FunctionCallNode byteArrayCall = new FunctionCallNode(new IdentifierNode("ByteArray"));
ContainerNode args = byteArrayCall.getArgumentsNode();
args.addItem(newBytes);
BinaryOperatorNodeBase assignmentBytes = BinaryOperatorNodeBase.create(assignToken, new IdentifierNode("bytes"), byteArrayCall);
ifContents.addItem(assignmentBytes);
// generate: return bytes;
ReturnNode returnStmt = new ReturnNode(null);
returnStmt.setStatementExpression(new IdentifierNode("bytes"));