flash actionscript:
Im make a shopping centre floor plan according to my XML file, and I generated
all the stores as a movie clip in run time, the codes are as following:
function floorplan() {
max = myshop.childNodes[0].childNodes.length;
spacing = 20;
//The following is to generate Stores and to put a number in the box
for (var r=0; r<max; r++) {
name = "shop" + r;
_root.list.attachMovie("shop", name, r);
_root.list[name]._x = r*20;
_root.list[name]._y = 0;
_root.list[name].name_text.text = r;
_root.list[name].name_text.textColor = 0xFFFFFF;
//The following is the generate the pop up boxes above the stores,
//and put the store name in text box:
shopname = myshop.childNodes[0].childNodes[r].attributes.name;
name1 = "frame" + r;
_root.list.attachMovie("frame", name1, r+1*100);
_root.list[name1]._x = r*20;
_root.list[name1]._y = -50;
_root.list[name1].store_name.text = shopname;
_root.list[name1]._alpha = 0;
// This is to make the pop up appear according to mouse roll over on store:
_root.list[name].onRollOver = function () {
temp = _root.list[name].name_text.text;
trace (temp);
temp2 = "frame" + temp;
_root.list[temp2]._alpha = 100;}
trace (shopname);
// The following is for the white box on the left:
_root.list[name].onRollOver = function () {
temp = _root.list[name].name_text.text;
trace (temp);
shopname = myshop.childNodes[0].childNodes[temp].attributes.name;
description = myshop.childNodes[0].childNodes[temp].attributes.url;
_root.board.store_name.text = shopname;
_root.board.store_description.text = description;
}
}
}
myshop = new XML ();
myshop.ignoreWhite = true;
myshop.load ("shops.xml");
myshop.onLoad = function (success) {
floorplan();
}
But I found it impossible to make the onRollOver function working properly
according to the stores you point to. It will only display information from the
last store generated.
Is there a way to assign individual script to the movie clip when it is
generated?
Thanks.