|
-
ComponentEvent.ENTER!...-nothing happens-
So i am trying to make an admin only part for this website I am doing. I have a button the person presses and it brings up a little ImputText field.
PHP Code:
name_txt.addEventListener(ComponentEvent.ENTER, checkerF);
function checkerF(e:ComponentEvent):void
{
trace("ENTER IS PRESSED");
if(name_txt.text = "username")
{
trace("NAME = USER ID");
gotoAndStop(3);
}
else
{
gotoAndStop(1);
}
}
For some reason, when I am pressing enter, no trace statements are tracing. I even tryed to target stage for the event that enter is pressed and that doesn't work either.
-
newb of many sorts
is name_txt actually a TextInput component, or is it a TextField with a type of TextFieldType.INPUT?
Also, is name_txt in focus when you press enter?
Search first, asked questions later.
-
newb of many sorts
this is a working example...
Code:
import fl.controls.*;
import fl.events.*;
var ti:TextInput = new TextInput();
ti.addEventListener(ComponentEvent.ENTER, doSomething);
addChild(ti);
function doSomething(e:ComponentEvent):void
{
trace('doing something');
}
note - the TextInput component needs to be in your library for this to work.
Search first, asked questions later.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|