* @param symbolClassType - determines the base type for the SymbolClass
*/
private void advancedGraphics(GraphicContentNode node, DefineTag symbol,
SymbolClassType symbolClassType)
{
MaskingNode maskNode = node.getMask();
// Create a new SymbolClass to map to this mask's
// DefineSprite (see below)
String className = graphicClass.getClassName();
if (maskNode != null)
className += "_Maskee";
className = createUniqueName(className);
FXGSymbolClass symbolClass = new FXGSymbolClass();
symbolClass.setPackageName(packageName);
symbolClass.setClassName(className);
// Then record this SymbolClass with the top-level graphic
// SymbolClass so that it will be associated with the FXG asset.
graphicClass.addAdditionalSymbolClass(symbolClass);
StringBuilder buf = new StringBuilder(512);
buf.append("package ").append(packageName).append("\n");
buf.append("{\n\n");
// Determine Base Class
String baseClassName = null;
if (symbolClassType == SymbolClassType.SPRITE)
{
buf.append("import flash.display.Sprite;\n");
baseClassName = "Sprite";
}
else
{
buf.append("import flash.display.Shape;\n");
baseClassName = "Shape";
}
// Advanced BlendModes
String blendModeImport = generateBlendModeImport(node.blendMode);
if (blendModeImport != null)
buf.append(blendModeImport);
String blendModeShader = generateBlendMode(node.blendMode);
// Class Definition and Constructor
buf.append("public class ").append(className).append(" extends ").append(baseClassName).append("\n");
buf.append("{\n");
buf.append(" public function ").append(className).append("()\n");
buf.append(" {\n");
buf.append(" super();\n");
buf.append(" this.cacheAsBitmap = true;\n");
// Alpha and Luminosity Masks
if (maskNode != null)
{
int maskIndex = maskNode.getMaskIndex();
if (symbolClassType == SymbolClassType.SPRITE)
buf.append(" this.mask = this.getChildAt(").append(maskIndex).append(");\n");
else
buf.append(" this.mask = this.parent.getChildAt(").append(maskIndex).append(");\n");
}