# Handcursor on an XML menu

**URL:** <https://forum.kirupa.com/t/handcursor-on-an-xml-menu/290597>\
**Category:** flash\
**Created:** [June 16, 2009, 10:57pm UTC](https://forum.kirupa.com/t/handcursor-on-an-xml-menu/290597 "2009-06-16T22:57:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitree](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dimitree/32/2530_2.png) [@Dimitree](https://forum.kirupa.com/u/Dimitree)\
**Post date:** [June 16, 2009, 10:57pm UTC](https://forum.kirupa.com/t/handcursor-on-an-xml-menu/290597/1 "2009-06-16T22:57:31Z")

</div>

I have this XML menu and my main problem is that I have to place the text elements each one of them into a movieclip in order to make the handcursor work.

The XML menu is made by this function

```auto

function xmlLoaded(event:Event):void {
	xml=XML(event.target.data);
	xmlList=xml.children();
	for (var i:int =0; i<xmlList.length(); i++) {
		// for the first element there is no previous textfield inserted			
		if (i==0) {
	createMainText(xmlList*.attribute("title"), xmlList*.attribute("link") , mainLinkLeftMargin , 8, 0 );
			createSublinks(xmlList,i);
		} else {
			// Create the text field getting positioning setting form the previous textField inserted
			createMainText(xmlList*.@title, xmlList*.attribute("link") , stage.getChildByName("mainLink"+(i-1).toString()).width + 
stage.getChildByName("mainLink"+(i-1).toString()).x + subLinkPadding, 8 , i );
			createSublinks(xmlList,i);
			
		}
	}

```

and then i have the function that formats the text

```auto

function createMainText(mainText:String, mainLink:String, xPosition:Number, yPosition:Number, indexNumber:Number):void {

	var dynText:TextField = new TextField();	
	stage.addChild(dynText);	
	dynText.selectable=false;	
	dynText.name="mainLink"+indexNumber.toString();
	dynText.embedFonts=true;
	dynText.text=mainText;
      
// tried to use this code but it doesn't seem to work
var MC_text = new MovieClip();
MC_text.buttonMode=true;
MC_text.useHandCursor=true;
MC_text.mouseChildren = false;
stage.addChild(MC_text);
dynText.setTextFormat(textFormatMain);		 
MC_text.addChild(dynText);
// cause it seems it nests only the first text element of the XML file

dynText.addEventListener(MouseEvent.MOUSE_OVER, subLinksShow);
dynText.addEventListener(MouseEvent.MOUSE_OVER, buttonModeTrue);
dynText.addEventListener(MouseEvent.MOUSE_OUT, buttonModeFalse);
stage.getChildByName("mainLink"+indexNumber.toString()).
addEventListener(MouseEvent.CLICK, CallArg.create(gotoSub, mainLink));

```

My question is where i should put this

```auto

var MC_text = new MovieClip();
MC_text.buttonMode=true;
MC_text.useHandCursor=true;
MC_text.mouseChildren = false;
stage.addChild(MC_text);
dynText.setTextFormat(textFormatMain);		 
MC_text.addChild(dynText);

```

in order to place each textfield into an identical Movieclip and make it behave like a button?:puzzled:
