# Checking value of input text?

**URL:** <https://forum.kirupa.com/t/checking-value-of-input-text/262392>\
**Category:** flash\
**Created:** [June 5, 2008, 4:05pm UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392 "2008-06-05T16:05:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pixelmech](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pixelmech](https://forum.kirupa.com/u/Pixelmech)\
**Post date:** [June 5, 2008, 4:05pm UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392/1 "2008-06-05T16:05:37Z")

</div>

Hi folks,

Working on a simple dog and pony show that needs to fake some password entry. I’m in Flash CS3 using AS2.0.

I have an Input Text field named “txt\_pinnums” and its line type is set to Password. It has a variable of “pinpassword”.

All I want to do when “btn\_ok” is pressed is check that the numbers entered on the keypad that are now in the input text field equal “1234”. It seems though that the value of that field is a bunch of HTML, not simple characters. Here is what I have:

```php

stop();
txt_pinnums.text = "";

function checkPin() {
    if(pinpassword eq "1234") {
        trace("good");
    }
    else
    {
        trace("bad");
    }
}

btn_ok.onRelease = function() {
    checkPin();
}

```

I’m sure my AS is not that good, but as I said this is just a simple show and tell demo that will be thrown away. How can I test that the input text equals 1234? If I do a trace(pinpassword) I get a bunch of HTML in addition to the characters entered.

Also, one syntactical question. I tried this:

```php

btn_ok.onRelease = checkPin;

```

But that doesn’t work… that type of thing works in JS though. Curious as to why it doesn’t work.

---

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [June 5, 2008, 5:14pm UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392/2 "2008-06-05T17:14:45Z")

</div>

```auto

stop();
txt_pinnums.text = "";

function checkPin() {
    if(txt_pinnums.text == "1234") {
        trace("good");
    }
    else
    {
        trace("bad");
    }
}

btn_ok.onRelease = function() {
    checkPin();
}  

```

is that what you are talking about?

---

<div class="post-metadata">

**Author:** ![Pixelmech](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pixelmech](https://forum.kirupa.com/u/Pixelmech)\
**Post date:** [June 5, 2008, 5:40pm UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392/3 "2008-06-05T17:40:21Z")

</div>

[quote=mrwicked;2337382] ActionScript Code:  
[LEFT][COLOR=#0000FF]stop[/COLOR]COLOR=#000000[/COLOR];  
txt\_pinnums.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]""[/COLOR];

[COLOR=#000000] **function** [/COLOR] checkPinCOLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]txt\_pinnums.[COLOR=#0000FF]text[/COLOR] == [COLOR=#FF0000]“1234”[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#0000FF]else[/COLOR]  
[COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]

btn\_ok.[COLOR=#0000FF]onRelease[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
checkPinCOLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

is that what you are talking about?[/quote]

For my second question, in a sense yes - I’m just wondering why you can’t assign a function call directly to an event. I guess AS doesn’t work that way. It’s no big deal was just curious, it works the way I have it. I more needing to get my main problem solved of checking the “password”.

---

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [June 5, 2008, 6:06pm UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392/4 "2008-06-05T18:06:39Z")

</div>

what I wrote is checking the password. Its checking if the password input is 1234 and if it is, trace good else trace bad

---

<div class="post-metadata">

**Author:** ![Pixelmech](https://avatars.discourse-cdn.com/v4/letter/p/df788c/32.png) [@Pixelmech](https://forum.kirupa.com/u/Pixelmech)\
**Post date:** [June 6, 2008, 2:36am UTC](https://forum.kirupa.com/t/checking-value-of-input-text/262392/5 "2008-06-06T02:36:15Z")

</div>

Whoops! Somehow I missed that, I see it now. Thanks! I will try that.
