I’m loading data into a movie clip via XML and an array system that duplicates a single movie clip any number of times, as defined by the XML file. The code is working, but what I would like to do now is be able to get the previous number from the array.
Here’s the script I’m using:
stop();
var newsXML:XML = new XML();
_level0.homeMC.newsMC.newsClips.newsXML.ignoreWhite = true;
_level0.homeMC.newsMC.newsClips.newsXML.load('news.xml');
_level0.homeMC.newsMC.newsClips.newsXML.onLoad = function():Void {
_level0.homeMC.newsMC.newsClips.nodeLength = this.firstChild.childNodes.length;
for (i=0; i<nodeLength; i++) {
newsPath = _level0.homeMC.newsMC.newsClips;
newsPath.newsClipping.duplicateMovieClip('newsClipping'+i, newsPath.getNextHighestDepth());
newsPath['newsClipping'+i]._y += getProperty(newsPath['newsClipping'+(i-1)], _y)+getProperty(newsPath['newsClipping'+(i-1)], _height);
newsPath['newsClipping'+i].newsTitle.text = this.childNodes[0].childNodes*.childNodes[0].firstChild;
newsPath['newsClipping'+i].newsDate.text = this.childNodes[0].childNodes*.childNodes[1].firstChild;
newsPath['newsClipping'+i].newsMessage.text = this.childNodes[0].childNodes*.childNodes[2].firstChild;
}
_level0.homeMC.newsMC.newsClips.newsClipping.unloadMovie();
};
The problem is on line 10 where I try to define the “_y” value for the duplicated movie clips. Since each clip is set to auto-size to fix the text content, I can’t have them a set distance apart. What I’m hoping to be able to do is to have it get the “_height” and “_y” values from the previous movie clip (so if it’s “newsClipping3” I want the values from “newsClipping2” and so on).
I’m new to the whole usage of arrays in scripting and this is the first time I’ve used this sort of script before so If anyone can tell me what I need to do or point me in the direction of a tutorial that will explain it that’d be of great help!
Time is a bit of a rush as I need this entire project done by Monday morning though… So the sooner I get an answer the better! Thanks!