Now we are going to take the nodes created in the previous recipe and arrange them to show a level of the tree (a parent with its children). We are going to place the parent in the middle and arrange the children around it with lines showing the relationship.
Open the files downloaded from the Packt Publishing website for Chapter 8 | Recipe 3 to follow along.
The following are the steps necessary to put the nodes together to make a relational network:
Create the class
RelationalNetwork.as
.Instantiate a
NodeVisual
object with the data provided; this is going to be our parent:_centerNode = new NodeVisual(data, 0,true);
Create a vector to hold all the child nodes.
Loop over the children of the parent node and instantiate a
NodeVisual
object for each of them:for (i = 0; i < data.children.length; i++) { angle = 360 / data.children.length * i; nodeVisual = new NodeVisual(data.children[i], angle); if (data.children.length...