* @param symbolClassType - determines the base type for the SymbolClass
*/
private void advancedGraphics(GraphicContentNode node, ICharacterTag symbol,
SymbolClassType symbolClassType)
{
IMaskingNode maskNode = node.getMask();
// Create a new SymbolClass to map to this mask's
// DefineSpriteTag (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 blendModeClass = null;
BlendMode blendmode = node.blendMode;
if(blendmode != null && blendmode.needsPixelBenderSupport()) {
blendModeClass = blendmode.getClassName();
addDependency(blendModeClass); //add dependency to this class
buf.append("import ").append(blendModeClass).append(";\n\n");
}
// 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");
}