e lo script che ho scaricato io è:
codice:
/* #####################################
» Menu Class
Written by: CyberPunk
Release Date: 9/4/03
Contact: alessandro.bianco@visual-emotion.it
##################################### */
// Constructor
_global.Menu = function(data_file, ref) {
// Set the menu reference
this._p = ref;
// Read the menu info from the xml file
this.XmlData = new XML();
this.XmlData.ignoreWhite = true;
this.XmlData._p = this;
this.XmlData.load(data_file);
this.XmlData.onLoad = function(ok) {
if (ok) {
this._p.SetVariables();
}
};
delete ref;
delete data_file;
};
// Parse the information loaded
Menu.prototype.SetVariables = function() {
// Set the vars readed from the xml file
this.Root = this.XmlData.childNodes;
this.Titles = new Array();
this.Links = new Array();
this.Tg = new Array();
this.Descriptions = new Array();
for (i=0; i<this.Root.length; i++) {
if (this.Root[i].nodeName.toUpperCase() == "MENU") {
this.Nodes = this.Root[i].childNodes;
for (k=0; k<this.Nodes.length; k++) {
this.Item++;
this.Titles.push(this.Nodes[k].attributes.id.toString());
this.Links.push(this.Nodes[k].attributes.page.toString());
this.Tg.push(this.Nodes[k].attributes.tg.toString());
this.Descriptions.push(this.Nodes[k].childNodes.toString());
}
}
}
delete this.Root;
delete this.Nodes;
delete this.XmlData;
this.DrawMenu();
};
// Construct the UI
Menu.prototype.DrawMenu = function() {
// Use vars and arrays to contruct the menu
for (i=0; i<this.Item; i++) {
this._p.attachMovie("ITEM", "Item" add i, i);
this._mc = eval(this._p add ".Item" add i);
this._mc._x = 0;
this._mc._y = 174+21*i;
this._mc.Title.label.htmlText = this.Titles[i].toUpperCase();
this._mc.Graphic.Slide.label.htmlText = this.Titles[i].toUpperCase();
this._mc.Link.Description.htmlText = "» " add this.Descriptions[i];
this._mc.Link.$link = this.Links[i];
this._mc.Link.$tg = this.Tg[i];
this.format = new TextFormat();
this.format.align = "right";
this._mc.Title.label.setTextFormat(this.format);
this._mc._id = i;
delete this.format;
}
this.SetAction();
this.SetActive(0);
};
// Set the action for the menu tabs
Menu.prototype.SetAction = function() {
for (i in this.Titles) {
this._mc = eval(this._p add ".Item" add i);
this._mc._ref = this;
this._mc.$active = (i == 0) ? true : false;
this._mc.Ico.gotoAndPlay((i == 0) ? "SlideIn" : "SlideOut");
this._mc.onRelease = function() {
if (this.$active == false) {
this._ref.SetActive(this._id);
}
};
this._mc.Link.onMouseUp = function () {
if (this.hitTest(_xmouse, _ymouse, true) && (this._parent.$active == true)) {
getURL(this.$Link, this.$Tg);
}
}
}
};
// Set the visualization options
Menu.prototype.SetActive = function(id) {
for (i in this.Titles) {
this._mc = eval(this._p add ".Item" add i);
// Move Title And Graphics of the Mc
this._mc.Ico.gotoAndPlay((id == i) ? "SlideIn" : (this._mc._currentframe != 1 && this._mc.$active == true) ? "SlideOut" : null);
this._mc.gotoAndPlay((id == i) ? "UnActive" : (this._mc._currentframe == 1) ? "Stop" : (this._mc.$active == true) ? "Active" : null);
this._mc.$active = (id == i) ? true : (this._mc._currentframe == 1) ? this._mc.$active : false;
// Move the tabs (with easing) in the correct position
if (id<i) {
// Move top to bottom
if (this._mc.act != "GoToBt") {
this._mc.__t__ = 0;
this._mc.act = "GoToBt";
delete this._mc.onEnterFrame;
this._mc.onEnterFrame = function() {
if (this._y == (21*this._id+174)) {
delete this.onEnterFrame;
this.act = "";
delete this._mc._x0;
delete this._mc._y0;
delete this._mc._x1;
delete this._mc._y1;
delete this._mc.spd;
delete this._mc.__t__;
}
this.moveFromTo(this._x, this._y, this._x, (21*this._id+174), 0.02);
};
}
} else if (id>=i) {
// Move bottom to top
if (this._mc.act != "GoToTp") {
this._mc.__t__ = 0;
this._mc.act = "GoToTp";
delete this._mc.onEnterFrame;
this._mc.onEnterFrame = function() {
if (this._y == 21*this._id) {
delete this.onEnterFrame;
this.act = "";
delete this._mc._x0;
delete this._mc._y0;
delete this._mc._x1;
delete this._mc._y1;
delete this._mc.spd;
delete this._mc.__t__;
}
this.moveFromTo(this._x, this._y, this._x, 21*this._id, 0.02);
};
}
}
}
delete id;
};
// Move Clips (written by gdeparta@yahoo.com )
MovieClip.prototype.moveFromTo = function(xFrom, yFrom, xTo, yTo, speed) {
this.x0 = xFrom == undefined ? this._x : xFrom;
this.y0 = yFrom == undefined ? this._y : yFrom;
this.x1 = xTo == undefined ? xFrom : xTo;
this.y1 = yTo == undefined ? yFrom : yTo;
this.spd = speed == undefined || speed>1 ? 0.0125 : speed;
this.__t__ += this.spd;
this._x = Math.round(this.x0+(this.x1-this.x0)*this.__t__);
this._y = Math.round(this.y0+(this.y1-this.y0)*this.__t__);
};