I have an array that generates a list of words that have links to site/page. but for some reason the URLs are being assigned randomly and i need to them to be specific to each word. Any suggestions? thanks.
// que of fill requests
fillRequests = new Array();
var vernacular = "Breakthrough Democracy Afghan Style Dwell DesignSource EndresWare Microsoft Darwin Min Day Nolo Now Rob Craigie Personal Science Squid Lab Instructables";
//links for words
links = ["http://www.breakthroughcollaborative.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com","http://www.ask.com","http://www.yahoo.com","http://www.google.com"];
//array of words
wordList = new Array();
wordList = vernacular.split(" ");
// fill the page with words!
fillRegion(0,0,720,480);
this.onEnterFrame = function() {
// pull fill requests from que and execute
if (fillRequests.length>0) {
freq = fillRequests.pop();
fillRegion(freq.x0, freq.y0, freq.x1, freq.y1, freq.d);
}
}
function fillRegion(x0, y0, x1, y1, d) {
// pick one of the words and place
n = random(wordList.length);
word = wordList[n];
ahref = links[n];
trace(n+" "+ ahref + word)
// place the word object
nombre = "word"+String(depth++);
neo = this.attachMovie("mcWord", nombre, depth);
// set word
neo.setWord(word);
neo.fitInto(x0, y0, x1, y1, d);
}
function fillRegionRequest(x0, y0, x1, y1, d) {
// request has been made to recursively fill a region
// only allow if reasonable
rWidth = x1-x0;
rHeight = y1-y0;
if ((rWidth>2) && (rHeight>2)) {
addFillRequest(x0, y0, x1, y1, d+1);
// fillRegion(x0, y0, x1, y1, d+1);
}
}
function addFillRequest(x0, y0, x1, y1, d) {
// que up a request to fill a region
var freq = {x0:x0, y0:y0, x1:x1, y1:y1, d:d};
fillRequests.push(freq);
}