# Newbie Button Problem

**URL:** <https://forum.kirupa.com/t/newbie-button-problem/191710>\
**Category:** flash\
**Created:** [June 22, 2006, 1:32pm UTC](https://forum.kirupa.com/t/newbie-button-problem/191710 "2006-06-22T13:32:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowey](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@lowey](https://forum.kirupa.com/u/lowey)\
**Post date:** [June 22, 2006, 1:32pm UTC](https://forum.kirupa.com/t/newbie-button-problem/191710/1 "2006-06-22T13:32:22Z")

</div>

Where am I going wrong the code highlighted below in blue. The xml is setup to produce 5 buttons but the trace that I have added generates 5 traces without the button being pressed.

var track\_xml = new XML();  
track\_xml.ignoreWhite = true;  
track\_xml.onLoad = function(success){  
if (success) CreateMenu(this);  
else trace(“Error loading XML file”);  
}  
track\_xml.load(“tracks.xml”);

var item\_spacing = 23;  
var item\_count = 0;

function CreateMenu(menu\_xml){  
var items = menu\_xml.firstChild.firstChild.childNodes;  
for (var i=0; i\<items.length; i++) {  
if (items\*.attributes.type == “track”) {  
var track = items\*.firstChild.childNodes;  
var item\_mc = menu\_mc.attachMovie(“main\_btn”,“main\_btn”+item\_count, item\_count);  
item\_mc.\_y = (item\_count \* item\_spacing);  
item\_count++;  
item\_mc.\_x = 0

item\_mc.track\_txt.text = track;  
[SIZE=4][COLOR=blue]item\_mc.main\_btn0.onPress = trace (“hello”)[/COLOR][/SIZE]  
}  
}  
}
