# How do I implement the use of "void?"

**URL:** <https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079>\
**Category:** flash\
**Created:** [January 26, 2003, 4:50pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079 "2003-01-26T16:50:44Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Afro\_Ninja](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Afro\_Ninja](https://forum.kirupa.com/u/Afro_Ninja)\
**Post date:** [January 26, 2003, 4:50pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/1 "2003-01-26T16:50:44Z")

</div>

OK here’s something I wrote:

on (release) {

if (\_root.playername == (void))  
{tellTarget (specialmessages) gotoAndPlay (2);}

else if (\_root.playerbirth == (void))  
{tellTarget (specialmessages) gotoAndPlay (16);}

else if (\_root.playername == (void) and \_root.playerbirth == (void))  
{tellTarget (specialmessages) gotoAndPlay (29);}

else

nextFrame ();  
}

On my screen are two input boxes (playername and playerbirth) and a button that advances to the next screen. The above code is for the button. All I’m trying to do is make it so that if there is nothing in the input boxes, then an error message will come up. The only way I could think of to represent nothing is “void” but it doesn’t work. (special messages is the mc that contains my error messages)

any help ? :\

---

<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:** [January 26, 2003, 5:01pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/2 "2003-01-26T17:01:03Z")

</div>

I’d just make it

if(something == “”) {  
bla bla  
}

or try

if(something == false) {  
bla bla  
}

just replace “something” with a textbox!

---

<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:** [January 26, 2003, 5:24pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/3 "2003-01-26T17:24:37Z")

</div>

or

\_root.playername == null

Null checks to see if it is empty (aka nothing there)

---

<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:** [January 26, 2003, 6:28pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/4 "2003-01-26T18:28:41Z")

</div>

lol “null” in my language means zero! (0) 😛

---

<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:** [January 26, 2003, 6:34pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/5 "2003-01-26T18:34:23Z")

</div>

LOL… same here in a way. We have a billion words for 0 in english.

---

<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:** [January 26, 2003, 6:55pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/6 "2003-01-26T18:55:24Z")

</div>

yeah I mknow I remember it from my english classes!  
What was it again … love, nil, null, zero , o , …etc (nothing more comes up right now)

---

<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:** [January 26, 2003, 7:30pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/7 "2003-01-26T19:30:49Z")

</div>

I use

!\_root.playername

(but not for strings lol)

---

<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:** [January 26, 2003, 9:37pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/8 "2003-01-26T21:37:14Z")

</div>

Yeah, I use that too. I use that if something is set to “false”

You had me for a second there, I was about to be like “YOU CAN DO THAT FOR STRINGS!!!”…then I read the parenthesis.

---

<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:** [January 26, 2003, 10:08pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/9 "2003-01-26T22:08:16Z")

</div>

ok… using “” and false doesn’t work at all

using null works, but it wont check correctly… for example:

When the screen first comes up, and you hit the button without putting something in either field, it will say “you did not enter a name or birthdate” which is correct. However, if you put something in each box and erase it, you can pass through. For some reason once you put something in a box, it always thinks there is something there, even if you erase it.

---

<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:** [January 27, 2003, 4:29pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/10 "2003-01-27T16:29:56Z")

</div>

Just thought I’d bump this real quick, maybe no one saw my post yesterday and I didn’t want to start a new one.

Anyways yeah that’s weird how the null thing is working…

---

<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:** [January 27, 2003, 5:37pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/11 "2003-01-27T17:37:49Z")

</div>

Ok, I have made a few changes to your above script.

The first if statement should be the one to check if both are empty. Then I also added if it was == to “” in case anyone deleted the content inside it registers as “” and you need to check for that.

And I also changed your tellTarget. tellTarget has been out since about Flash 4 I believe, although I noticed a lot of Flash 5 tutorials use it, which makes no sense because there is an easier way.

```auto
on (release) {
	if ((_root.playername == null || _root.playername == "") && (_root.playerbirth == null || _root.playerbirth == "")) {
		_root.specialmessages.gotoAndPlay(29);
	} else if (_root.playername == null || _root.playername == "") {
		_root.specialmessages.gotoAndPlay(2);
	} else if (_root.playerbirth == null || _root.playerbirth == "") {
		_root.specialmessages.gotoAndPlay(16);
	} else {
		_root.nextFrame();
	}
}

```

Just some side notes:

|| is a boolean “or” statement. So it says if \<I\>This\</I\> \<B\>or\</B\> \<I\>That\</I\> are true than do the following. It means any of the statements can be true, but not all of them need to be.

And && is a boolean “and” statement. So it says if \<I\>This\</I\> \<B\>and\</B\> \<I\>That\</I\> are true, then do the following. It means both statements MUST be true.

---

<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:** [January 27, 2003, 5:58pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/12 "2003-01-27T17:58:17Z")

</div>

And just because I am bored, I set up an example .fla that exports the error to a dynamic textbox when you hit the submit button.

---

<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:** [January 27, 2003, 8:38pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/13 "2003-01-27T20:38:00Z")

</div>

Thank you verrryyryyryry much!!

wow, all this time using tellTarget and I had no idea you could just do that… and yeah, outputting the error to a dynamic text box is a thousand times better.

:sleep:

---

<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:** [January 27, 2003, 9:31pm UTC](https://forum.kirupa.com/t/how-do-i-implement-the-use-of-void/12079/14 "2003-01-27T21:31:39Z")

</div>

Glad your problem is solved 🙂

Yeah, I figured outputting to a textbox would be better and easier 🙂

I tested myself using the trace(expression) function in Flash. Then after I got everything working I removed the traces and threw in a dynamic text box and displayed it that way.

On another note: I put the first if statement as being if both are empty because in your original script if both were empty it only said the playername box was empty since that was first in the chain of if statements. So checking if both are empty first is the way to go, if both aren’t empty, then check for playername, then check playerbirth, then if all of that is fine… just play nextFrame() 😉
