A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3 Input text, and pressing a button to verify an answer

  1. #1
    Member
    Join Date
    Aug 2008
    Posts
    41

    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

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    This will get you started
    PHP Code:
    cross.visible false;
    tick.visible false;

    checkButton.addEventListener(MouseEvent.CLICKcheckInput);

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center