hell hello,
Sorry if this is a little confusing, but i cracked into my vodka store and it still didn’t help me solve the problem xD
Anyways, I am attempting to build a xml driven drop down menu where everything is taken from xml. now the problem arises with submenues. I have them being created fine, but it’s the mouse out that won’t work. I want to use a hittest to check if my mouse is over any of the submenues and if not just to trace something so I know it’s working.
The problem is when i mouse of one clip onto the next it fails the hittest and traces. There isn’t a space between the two MC’s so I dunno what would be causing this.
I have read sen’s guide but I’m not pulling things from the library. Everything is being created at run time so I can’t use the attach movie, so I am just positioning them below each other.
here is my code. Thanks for the help if anyone can provide insight. Sorry if this is slightly confusing, but this has been pestering me all day.
var menuXML:XML = new XML();
menuXML.ignoreWhite = true;
menuXML.onLoad = function(success){
if (success){
makeMenu();
}
}
menuXML.load("data/menu.xml");
function makeMenu(){
miX = 0;
miY = 0;
for(var i=0;i<menuXML.firstChild.childNodes.length;i++){
menuName = menuXML.firstChild.childNodes*.attributes.iN;
this.createEmptyMovieClip(menuName,this.getNextHighestDepth());
createBackground(this[menuName]);
this[menuName].id = i;
if(menuXML.firstChild.childNodes*.nodeName == "i"){
this[menuName].onRelease = function(){
trace(menuXML.firstChild.childNodes[this.id].attributes.l);
}
}else{
this[menuName].miX = miX;
this[menuName].onRollOver = function(){
createSubMenu(this._height,this.id,this.miX);
}
}
this[menuName]._x = miX;
this[menuName]._y = miY;
miX += 100;
miY += 0;
}
}
function createBackground(clipName:MovieClip){
clipName.lineStyle(0);
clipName.beginFill(0xEE33AA,100);
clipName.moveTo(0,0);
clipName.lineTo(50,0);
clipName.lineTo(50,10);
clipName.lineTo(0,10);
clipName.endFill();
}
function createSubMenu(clipHeight:Number,a:Number,miX:Number){
smiY = clipHeight;
smiX = miX;
for(var i=0;i<menuXML.firstChild.childNodes[a].childNodes.length;i++){
submenuName = menuXML.firstChild.childNodes[a].childNodes*.attributes.iN;
this.createEmptyMovieClip(submenuName,this.getNextHighestDepth());
createBackground(this[submenuName]);
this[submenuName]._x = miX;
this[submenuName]._y += smiY;
this[submenuName].id = i;
this[submenuName].onRelease = function(){
trace(menuXML.firstChild.childNodes[a].childNodes[this.id].attributes.l);
}
this[submenuName].onRollOut = function(){
//do hittest thingy
for(var i = menuXML.firstChild.childNodes[a].childNodes.length;i > 0;i--){
if(i == menuXML.firstChild.childNodes[a].childNodes.length){
ifState = "!menuXML.firstChild.childNodes[a].childNodes*.attributes.iN.hitTest(_xmouse,_ymouse,true)";
}else{
ifState += " && !menuXML.firstChild.childNodes[a].childNodes*.attributes.iN.hitTest(_xmouse,_ymouse,true)";
}
}
if([ifState]){
trace("PLEASE WORK!");
}
}
smiY += this[submenuName]._height;
}
}