In this recipe, we will create the building block for our relational network: the node. This is basically a circle with a label in the middle. If it is not the center node (the parent), then it will also display how many children it has.
Open the files downloaded from the Packt Publishing website for Chapter 8 | Recipe 2 folder to follow along.
The following are the steps required to do the visuals for a node:
Create the
NodeVisual.as
class where everything will happen.Add in the constructor code to draw the under circle and the gradient circle:
_underCircle = new Shape(); _underCircle.graphics.beginFill(0xffffff); _underCircle.graphics.drawCircle(0, 0, _radius); addChild(_underCircle); _circle = new Sprite(); var matrix:Matrix = new Matrix(); matrix.createGradientBox(_radius*2, _radius*2, 0, -_radius, -_radius); _circle.graphics.lineStyle(1, _color); _circle.graphics.beginGradientFill(GradientType.RADIAL, [0xffffff, _color], [0.2...