ok this i sbugging me so i hope someone can help
i have an xml file which i am reading into flash and then looping though and displaying the data in a movieclip.
i was using the below code which was working fine
there is a movieclip on the main stage called menu_mc
var xml : XML = new XML();
xml.ignoreWhite = true;
xml.load( "menu.xml" );
xml.onLoad = function()
{
topics = xml.firstChild.childNodes;
var currentY = 0;
var index = 0
for ( var i = 0 ; i < topics.length ; i++ )
{
var topic : Array = topics*;
var posts : Array = topic.firstChild.childNodes;
menu_mc.createEmptyMovieClip( "topic_mc" + index , menu_mc.getNextHighestDepth() );
var topic_mc : MovieClip = menu_mc["topic_mc" + index];
topic_mc._y += 20 * currentY;
topic_mc.createTextField( "topic_txt" + index , topic_mc.getNextHighestDepth() , 50 , 50 , 300 , 20 );
var topic_txt : TextField = topic_mc["topic_txt" + index];
topic_txt.text = topics*.attributes.name;
currentY++;
for ( var j = 0 ; j < posts.length ; j++ )
{
var post : Array = posts[j];
menu_mc.createEmptyMovieClip( "post_mc" + index , menu_mc.getNextHighestDepth() );
var post_mc : MovieClip = menu_mc["post_mc" + index];
post_mc._x = 10;
post_mc._y += 20 * currentY;
post_mc.createTextField( "post_txt" + index , post_mc.getNextHighestDepth() , 50 , 50 , 300 , 20 );
var post_txt : TextField = post_mc["post_txt" + index];
post_txt.text = posts[j].attributes.name;
currentY++;
index++;
}
}
}
this produced the following results which is how i wanted it to look.
but i want the post movieclips to be inside there parent topic clip.
so i changed my code to do this to the following
var xml : XML = new XML();
xml.ignoreWhite = true;
xml.load( "menu.xml" );
xml.onLoad = function()
{
topics = xml.firstChild.childNodes;
var currentY = 0;
var index = 0
for ( var i = 0 ; i < topics.length ; i++ )
{
var topic : Array = topics*;
var posts : Array = topic.firstChild.childNodes;
menu_mc.createEmptyMovieClip( "topic_mc" + index , menu_mc.getNextHighestDepth() );
var topic_mc : MovieClip = menu_mc["topic_mc" + index];
topic_mc._y += 20 * currentY;
topic_mc.createTextField( "topic_txt" + index , topic_mc.getNextHighestDepth() , 50 , 50 , 300 , 20 );
var topic_txt : TextField = topic_mc["topic_txt" + index];
topic_txt.text = topics*.attributes.name;
currentY++;
for ( var j = 0 ; j < posts.length ; j++ )
{
var post : Array = posts[j];
topic_mc.createEmptyMovieClip( "post_mc" + index , topic_mc.getNextHighestDepth() );
var post_mc : MovieClip = topic_mc["post_mc" + index];
post_mc._x = 10;
post_mc._y += 20 * currentY;
post_mc.createTextField( "post_txt" + index , post_mc.getNextHighestDepth() , 50 , 50 , 300 , 20 );
var post_txt : TextField = post_mc["post_txt" + index];
post_txt.text = posts[j].attributes.name;
currentY++;
index++;
}
}
}
but now the results look like this
any ideas what is making this happen?