Hello, i have a xml menu and when i go to other frame my menu doenst
unload...
i tried with the functions clearMenu and clearSubMenu but they dont
work..please help..i will send the code:
import mx.xpath.XPathAPI;
var infoHolder:XML = new XML();
infoHolder.load(menuInfoXML);
infoHolder.ignoreWhite = true;
var titlePath:String = "/root";
//main menu array.
var mainMenus:Array;
//sub menu array.
var subMenus:Array;
//load the xml with xpath
infoHolder.onLoad = function(ok) {
if (ok) {
mainMenus = mx.xpath.XPathAPI.selectNodeList(infoHolder.firstChild,
titlePath+"/menu");
createTreeMenu();
}
};
MovieClip.prototype.getPos = function(target:Number) {
this.onEnterFrame = function() {
this._y -= (this._y-target)/6;
if (Math.abs(this._y-target)<0.3) {
delete this.onEnterFrame;
_root.newsMC.showNews.appear();
}
};
};
function createTreeMenu():Void {
for (i=0; i<mainMenus.length; i++) {
newBut = _root.attachMovie("but", "but"+i, 9999999+i);
newBut.arrow._alpha = 0;
newBut.shine._alpha = 0;
newBut._x = 105;
newBut._y = 180+(newBut._height+5)*i;
newBut.txt.text = mainMenus[i].attributes.txt;
newBut.link2 = mainMenus[i].attributes.url;
newBut.submenuCnt = mainMenus[i].childNodes.length;
newBut.y = newBut._y;
newBut.onRollOver = function() {
_root.tween(this, 10, 13);
this.arrow.appear();
this.shine.appear();
var textCol = new Color(this.txt);
textCol.setRGB(0xffffff);
};
newBut.onRollOut = function() {
_root.tween(this, 15, 10);
this.arrow.disappear();
this.shine.disappear();
var textCol = new Color(this.txt);
textCol.setRGB(0x6F6A63);
};
newBut.onRelease = function() {
if (this.submenuCnt>0) {
var butNum:Number = new Number(this._name.substr(3, 1));
this.createSubMenu(butNum);
for (i=0; i<mainMenus.length; i++) {
if (i<butNum+1) {
_root["but"+i].getPos(_root["but"+i].y);
} else {
_root["but"+i].getPos(_root["but"+i].y+this.submenuCnt*22);
}
}
}
else {
_root.conteudos_mc.portfolio_mc.clearSubMenus();
for (i=0; i<mainMenus.length; i++) {
_root["but"+i].getPos(_root["but"+i].y);
}
}
};
}
}
MovieClip.prototype.createSubMenu = function(buttonNumber:Number):Void {
clearSubMenus();
subMenus = mx.xpath.XPathAPI.selectNodeList(mainMenus[buttonNumber],
"/menu/submenu");
var butNum:Number = new Number(this._name.substr(3, 1));
for (i=0; i<subMenus.length; i++) {
subBut = _root.attachMovie("submenu", "subMenu"+i, Math.random
()*999999);
subBut._alpha = 0;
subBut._x -= i;
subAppear(subBut, (i+3), 130);
subBut._y = this.y+this._height+(subBut._height+5)*i;
subBut.txt.text = subMenus[i].attributes.txt;
subBut.link2 = subMenus[i].attributes.url;
subBut.but.onRollOver = function(){
var textSubCol = new Color(this._parent.txt);
textSubCol.setRGB(0xffffff);
}
subBut.but.onRollOut = function(){
var textSubCol = new Color(this._parent.txt);
textSubCol.setRGB(0x6F6A63);
}
subBut.but.onRelease = function() {
loadMovie(this._parent.link2, "_root.conteudos_mc.vazio4_mc");
//this doesnt disapear either...
//trace(this._parent);
};
}
};
function clearSubMenus() {
for (k=0; k<subMenus.length; k++) {
_root["subMenu"+k].removeMovieClip();
}
}
function clearAllMenus() {
for (i=0; i<mainMenus.length; i++) {
_root["but"+i].removeMovieClip();
}
}
Sorry..but im really desperate with this...i tried with unloadMovie, and
...nothing happens...
Many thanks.
Jose Maria
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com