Question
Can't duplicate movieclips as an array within an array
Hello.
I have an animation that loads an xml into it and traces back an array within an array. I have tried to apply this to duplicated movieclips thereby creating a structured set of links. What I am trying to do is this:
Chicken Nuggets
__Compression
__Texture
__Disgust
Mega Warhead
__Taste
__Hardness
__Pain
This traces fine but I can't seem to get the duplicated movieclips to assemble in this fashion.
The code for the XML is as follows:
var controlArray:Array;
var variable:Array;
var testTopic = new Array ();
var test = new Array ();
var controlsXML:XML = new XML();
controlsXML.ignoreWhite = true;
controlsXML.onLoad = function(success:Boolean){
if (success){
var mainnode:XMLNode = controlsXML.firstChild;
var controlNodes:Array = controlsXML.firstChild.firstChild.firstChild.firstChild.childNodes;
var list:Array = new Array();
for (var i:Number = 0; i < controlNodes.length; i++) {
var personnode:XMLNode = controlNodes .attributes.Name;
trace(personnode);
testTopic.push (new struct (personnode));
var specificNode:Array = controlNodes.childNodes;
for (var j:Number = 0; j < specificNode.length; j++){
var itemnode:XMLNode = specificNode.attributes.Variable;
trace(itemnode);
test.push (new struct2 (itemnode));
}
}
printer ();
printer2 ();
} else {
trace('error reading XML');
}
};
controlsXML.load ("controls3.xml");
The code for the movieclip duplication is as follows:
x = 50;
function printer ()
{
for (m = 0; m < testTopic.length; m++)
{
duplicateMovieClip ( slotTopic, "slotTopic" + m, m );
slotTopic = eval ( "slotTopic" + m );
slotTopic._y += x;
slotTopic.slotTopicContent.text = testTopic.personnode;
}
}
function printer2 ()
{
for (k = 0; k < test.length; k++)
{
duplicateMovieClip ( slot, "slot" + k, k );
slot = eval ( "slot" + k );
slot._y += x;
slot.slotContent.text = test.itemnode;
}
}
function struct (personnode)
{
this.personnode = personnode;
}
function struct2 (itemnode)
{
this.itemnode = itemnode;
}
On the stage are two movieclips, titled "slotTopic" and "slot". Within those are dynamic text boxes titled respectively "slotTopicContent" and "slotContent". When I preview this file it only displays the text within the "slot" movieclip and it lists all six of the subtopics with no break. So, there are two dilemmas:
1) The movieclips won't duplicate into the structured set of links that I want.
2) "slotTopic" is not displaying text at all.
If anyone has any advice, I'd really appreciate it. Thx!
I have an animation that loads an xml into it and traces back an array within an array. I have tried to apply this to duplicated movieclips thereby creating a structured set of links. What I am trying to do is this:
Chicken Nuggets
__Compression
__Texture
__Disgust
Mega Warhead
__Taste
__Hardness
__Pain
This traces fine but I can't seem to get the duplicated movieclips to assemble in this fashion.
The code for the XML is as follows:
var controlArray:Array;
var variable:Array;
var testTopic = new Array ();
var test = new Array ();
var controlsXML:XML = new XML();
controlsXML.ignoreWhite = true;
controlsXML.onLoad = function(success:Boolean){
if (success){
var mainnode:XMLNode = controlsXML.firstChild;
var controlNodes:Array = controlsXML.firstChild.firstChild.firstChild.firstChild.childNodes;
var list:Array = new Array();
for (var i:Number = 0; i < controlNodes.length; i++) {
var personnode:XMLNode = controlNodes .attributes.Name;
trace(personnode);
testTopic.push (new struct (personnode));
var specificNode:Array = controlNodes.childNodes;
for (var j:Number = 0; j < specificNode.length; j++){
var itemnode:XMLNode = specificNode
trace(itemnode);
test.push (new struct2 (itemnode));
}
}
printer ();
printer2 ();
} else {
trace('error reading XML');
}
};
controlsXML.load ("controls3.xml");
The code for the movieclip duplication is as follows:
x = 50;
function printer ()
{
for (m = 0; m < testTopic.length; m++)
{
duplicateMovieClip ( slotTopic, "slotTopic" + m, m );
slotTopic = eval ( "slotTopic" + m );
slotTopic._y += x;
slotTopic.slotTopicContent.text = testTopic
}
}
function printer2 ()
{
for (k = 0; k < test.length; k++)
{
duplicateMovieClip ( slot, "slot" + k, k );
slot = eval ( "slot" + k );
slot._y += x;
slot.slotContent.text = test
}
}
function struct (personnode)
{
this.personnode = personnode;
}
function struct2 (itemnode)
{
this.itemnode = itemnode;
}
On the stage are two movieclips, titled "slotTopic" and "slot". Within those are dynamic text boxes titled respectively "slotTopicContent" and "slotContent". When I preview this file it only displays the text within the "slot" movieclip and it lists all six of the subtopics with no break. So, there are two dilemmas:
1) The movieclips won't duplicate into the structured set of links that I want.
2) "slotTopic" is not displaying text at all.
If anyone has any advice, I'd really appreciate it. Thx!