I’m currently using a script I picked up from these forums to attach movieclips from the library based on how many child’s there are in an XML document.
I was wondering if it was possible though, to have each movieclip placed in a random location on the stage; but restrict that random location to a SHAPE I draw? For example if I drew a giant star, and wanted the movieclips to randomly attach anywhere within the boundaries of the star?
I know there are methods of restricting the random placement by using x and y values to keep it below or above a certain line, but is it possible to restrict placement within custom drawn shapes?
Here is the script I’m using atm:
function loadXML(true) {
if (true) {
xmlNode = this.firstChild;
title = [];
info = [];
url = [];
show_content();
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("objects.xml");
function show_content() {
//For loop to attach our container movieclip and pass the xml information
for(i=0;i<total;i++){
//define xml
name* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
donation* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
message* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
colour* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
//attach container clip
currMovie = attachMovie("container", "xml"+i, i, {_x:0, _y:0});
//add the information
currMovie.name.text = name*;
currMovie.donation.text = donation*;
currMovie.message.url = message*;
currMovie.gotoAndStop(colour*);
}
}