-
AS3 Input text, and pressing a button to verify an answer
Hi there everyone!
In AS2 i used to create these no problem! I want to get into AS3.
I would like to have an input text box appear on the screen with a question next to it, im expecting a literal answer like "cat", when they click a button either a cross will appear or a tick will appear in the event of them getting it right or wrong.
I used to create this all the time in as2 with code like
if(_root.input=="Cat"){_root.tick._visible=true;}e lse ...
How would i go about doing this is AS3, is anyone willing to get me started? I can program pretty well but running a few searches i can only seem to find input text stuff to the screen and button pressing to put text on the screen, not one i need which comnpares an input string and displays a mc using visible.
Can anyone help
-
.
Hi,
This will get you started
PHP Code:
cross.visible = false;
tick.visible = false;
checkButton.addEventListener(MouseEvent.CLICK, checkInput);
function checkInput(e:MouseEvent):void
{
if (inputText.text == "Cat")
{
tick.visible = true;
cross.visible = false;
}
else
{
tick.visible = false;
cross.visible = true;
}
}
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
|