# Trying to add blur filter to kirupa xmlmenu - what am i doing wrong?

**URL:** <https://forum.kirupa.com/t/trying-to-add-blur-filter-to-kirupa-xmlmenu-what-am-i-doing-wrong/202057>\
**Category:** Uncategorized\
**Created:** [September 27, 2006, 11:56am UTC](https://forum.kirupa.com/t/trying-to-add-blur-filter-to-kirupa-xmlmenu-what-am-i-doing-wrong/202057 "2006-09-27T11:56:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mejnik](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@mejnik](https://forum.kirupa.com/u/mejnik)\
**Post date:** [September 27, 2006, 11:56am UTC](https://forum.kirupa.com/t/trying-to-add-blur-filter-to-kirupa-xmlmenu-what-am-i-doing-wrong/202057/1 "2006-09-27T11:56:11Z")

</div>

Here’s the case. The buttons are by default blured. OnRollover the selected button gets blur cleared. OnRollOut it gets blured again. Here’s the code

// generates a list of menu items (effectively one menu)  
// given the inputted parameters. This makes the main menu  
// as well as any of the submenus  
GenerateMenu = function(holder, name, x, y, depth, node\_xml) {  
// variable declarations  
var curr\_node;  
var curr\_item;  
var curr\_menu = holder.createEmptyMovieClip(name, depth);

// for all items or XML nodes (items and menus)  
// within this node\_xml passed for this menu  
for (var i=0; i\<node\_xml.childNodes.length; i++) {  
// movieclip for each menu item  
curr\_item = curr\_menu.attachMovie(“menuitem”,“item”+i+"\_mc", i);  
curr\_item.\_x = x;  
curr\_item.\_y = y + i_1.5_curr\_item.\_height  
curr\_item.trackAsMenu = true;

// item properties assigned from XML  
curr\_node = node\_xml.childNodes\*;  
curr\_item.action = curr\_node.attributes.action;  
curr\_item.variables = curr\_node.attributes.variables;  
curr\_item.name.text = curr\_node.attributes.name;

curr\_item.onRollOver = curr\_item.onDragOver = function(){  
};

curr\_item.onRollOut = curr\_item.onDragOut = function(){  
// restore color

};

// any item, menu opening or not can have actions  
curr\_item.onRelease = function(){  
Actionsthis.action;  
CloseSubmenus();  
};  
} // end for loop

};  
// create the main menu, this will be constantly visible  
CreateMainMenu = function(x, y, depth, menu\_xml){  
// generate a menu list  
GenerateMenu(this, “mainmenu\_mc”, x, y, depth, menu\_xml.firstChild);  
// close only submenus if visible durring a mouseup  
// this main menu (mainmenu\_mc) will remain  
};  
// closes all submenus by removing the submenu\_mc  
// in the main menu (if it exists)  
CloseSubmenus = function(){  
mainmenu\_mc.submenu\_mc.removeMovieClip();  
};  
// This actions object handles methods for actions  
// defined by the XML called when a menu item is pressed  
Actions = Object();  
Actions.gotoURL = function(urlVar){  
getURL(urlVar, “\_blank”);  
};  
Actions.message = function(msg){  
message\_txt.text = msg;  
};  
Actions.newMenu = function(menuxml){  
menu\_xml.load(menuxml);  
};  
// load XML, when done, run CreateMainMenu to interpret it  
menu\_xml = new XML();  
menu\_xml.ignoreWhite = true;  
menu\_xml.onLoad = function(ok){  
// create main menu after successful loading of XML  
if (ok){  
CreateMainMenu(10, 10, 0, this);  
message\_txt.text = “message area”;  
}else{  
message\_txt.text = “error: XML not successfully loaded”;  
}  
};  
// load first XML menu  
menu\_xml.load(“menu2.xml”);

var myBlur = new flash.filters.BlurFilter(20,20,2);  
var myTempFilters:Array = this.mainmenu.submenu.filters;  
myTempFilters.push(myBlur);  
this.mainmenu.submenu.filters = myTempFilters;  
circle\_mc.onRollOut = function() {  
myBlur.blurX = 20;  
myBlur.blurY = 20;  
this.filters = new Array(myBlur);  
}  
circle\_mc.onRollOver = function() {

```
myBlur.blurX = 0;

```

myBlur.blurY = 0;  
this.filters = new Array(myBlur);  
}
