# Text on Scripted Button does not shows on rollover an on release

**URL:** <https://forum.kirupa.com/t/text-on-scripted-button-does-not-shows-on-rollover-an-on-release/114061>\
**Category:** Uncategorized\
**Created:** [June 24, 2004, 9:59am UTC](https://forum.kirupa.com/t/text-on-scripted-button-does-not-shows-on-rollover-an-on-release/114061 "2004-06-24T09:59:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beebs](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Beebs](https://forum.kirupa.com/u/Beebs)\
**Post date:** [June 24, 2004, 9:59am UTC](https://forum.kirupa.com/t/text-on-scripted-button-does-not-shows-on-rollover-an-on-release/114061/1 "2004-06-24T09:59:13Z")

</div>

I’ve got this following scripts to create button through action script. However during onrollover/onrelease, the text (button name) is dissapear. Can someone give me a workaround. Thanks.  
Here’s the code:

```auto
depth = 1;

mouse_over_colour = 0xCCCCCC;
mouse_clicked_colour = 0x666666;
area_width = 200;

ButtonLabelText = new TextFormat();
ButtonLabelText.bold = false;
ButtonLabelText.color = 0x000000;
ButtonLabelText.font = "Verdana";
ButtonLabelText.size = 9;

main_menu = ['About', 'Work', 'Client', 'Contact', 'Consume'];
main_menu_action = ['work.swf', 'about.swf', 'store.swf', 'client.swf', 'contact.swf'];

for (i=0; i<main_menu.length; i++) {
	main_menu_var = "main_menu_"+i;
	_root.createEmptyMovieClip(main_menu_var, depth++);
	_root[main_menu_var].createTextField("titleField", depth++, 0, -3, area_width, 15);
	_root[main_menu_var].titleField.selectable = false;
	_root[main_menu_var].titleField.setNewTextFormat(ButtonLabelText);
	_root[main_menu_var].titleField.text = main_menu*;
	_root[main_menu_var]._y = i*15;
	_root[main_menu_var].onRelease = function() {
		_root[main_menu_var]["click_effect_"+i].removeMovieClip();
		this.createEmptyMovieClip("click_effect_"+i, depth++);
		with (this["click_effect_"+i]) {
			beginFill(mouse_clicked_colour, 100);
			lineStyle(0, mouse_clicked_colour, 100);
			moveTo(0, 0);
			lineTo(0, 0);
			lineTo(area_width, 0);
			lineTo(area_width, 9);
			lineTo(0, 9);
			endFill();
		}
		trace(_root[main_menu_var]["click_effect_"+i]);
		loadMovieNum(main_menu_action*, depth++);
	};
	_root[main_menu_var].onRollOver = function() {
		this.over_effect.removeMovieClip();
		this.createEmptyMovieClip("over_effect", depth++);
		with (this.over_effect) {
			beginFill(mouse_over_colour, 100);
			lineStyle(0, mouse_over_colour, 100);
			moveTo(0, 0);
			lineTo(0, 0);
			lineTo(area_width, 0);
			lineTo(area_width, 9);
			lineTo(0, 9);
			endFill();
		}
	};
	_root[main_menu_var].onRollOut = function() {
		this.over_effect.removeMovieClip();
	};
	_root[main_menu_var].onRelease = function() {
		_root[prevname]["click_effect_"+prevname].removeMovieClip();
		prevname = this._name;
		this.createEmptyMovieClip("click_effect_"+this._name, depth++);
		with (this["click_effect_"+this._name]) {
			beginFill(mouse_clicked_colour, 100);
			lineStyle(0, mouse_clicked_colour, 100);
			moveTo(0, 0);
			lineTo(0, 0);
			lineTo(area_width, 0);
			lineTo(area_width, 9);
			lineTo(0, 9);
			endFill();
		}
		tval = main_menu_action[this._name.slice(this._name.length-1, this._name.length)];
		trace("tval=" + tval);
		loadMovieNum(tval, depth++);
	};
}

```
