# Create / destroy textbox function :: not working

**URL:** <https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745>\
**Category:** Uncategorized\
**Created:** [April 8, 2003, 8:25pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745 "2003-04-08T20:25:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [April 8, 2003, 8:25pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/1 "2003-04-08T20:25:15Z")

</div>

i have a series of buttons over which i want a text box to appear when they are the rollOver and rollOut events are triggered.

on rollOver i want the box to be created and display content

and on rollOut i want the box to be deleted

the box is created fine and displays the content and follows the mouse just like it’s supposed to … but it won’t go away when i say delete \_root.label

any ideas how to fix this?

here’s the code

```php

makelabel = function () {
	_root.createEmptyMovieClip('label', 1002);
	_root.label.createTextField("insidelabel", 1003, -30, -30, 50, 18);
	_root.label.insidelabel.background = true;
	_root.label.insidelabel.selectable = false;
	_root.label.onEnterFrame = function() {
		this._y = _root._ymouse;
		this._x = _root._xmouse;
		_root.label.insidelabel.text = _root.select;
	};
};
destroylabel = function () {
	delete _root.label;
};

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 8:47pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/2 "2003-04-08T20:47:59Z")

</div>

in case anyone is wondering i solved it by saying \_root.label.\_visible = 0; instead of trying to delete it … i guess delete is for another purpose :sigh:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 8, 2003, 9:47pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/3 "2003-04-08T21:47:34Z")

</div>

delete is for deleting variables and objects, not items on the stage.

\_visible = 0 works, but if you want to get rid of it entirely you can put it in a movie clip symbol and use removeMovieClip()

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 9, 2003, 3:56pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/4 "2003-04-09T15:56:53Z")

</div>

right so the function should look like this … ?

```php

destroylabel = function () {
    removeMovieClip(_root.label);
};

```

and then the next time the function is triggered the mc will be created again … ?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 9, 2003, 5:37pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/5 "2003-04-09T17:37:41Z")

</div>

No, running a function that removes the movie clip twice does not bring the clip back. When you run it once it removes the clip, meaning it removes it from the stage and it isn’t there anymore.

If you want it to return later, then you use \_visible like you did. That way you can toggled it from false to true repeatedly.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 9, 2003, 7:24pm UTC](https://forum.kirupa.com/t/create-destroy-textbox-function-not-working/17745/6 "2003-04-09T19:24:50Z")

</div>

ok … =)
