Skip navigation
teacheRuss
Currently Being Moderated

Simple Quiz using ActionScript 1 and 2

Jun 14, 2012 6:52 AM

Having a few problems with a simple quiz game in Flash CS4. When the correct answer is typed into the insert text box the wrong message on the wrong frame comes up. I have tried using frame numbers in the actionscript and frame name flags. Whatever answer I type in it sends me to the wrong frame. I cannot see what the problem is. Could you take a look for me. I have added the code below. FOnts are embedded - have tried embed all etc. My button is called Ent and the input text box is A1. I have disabled keyboard short cuts in the flash player too. Tried running .SWF fiel on its own.

 

From teh code below when my flash file runs I type in NaCl but the frame containg a message Q1F (below) is called. I cannot see why it is not Q1T. I have tried using 3 adn 4 in brackets without quotes as well. I have also tried using _root.gotoAndStop()

 

Regards

 

teacheRuss

 

 

Ent.onRelease = function() {

 

    if(A1.text == "NaCl")
{

         _root.gotoAndPlay("Q1T")

      } else  { 
         _root.gotoAndPlay("Q1F")

      } 

 
Replies
  • Currently Being Moderated
    Jun 14, 2012 6:56 AM   in reply to teacheRuss

    First try tracing the A1.text value before the conditional to see that it is what you expect it to be...

     

    trace(A1.text);

    if(A1.text == "NaCl")...

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 14, 2012 9:47 AM   in reply to teacheRuss

    One thing to do is to investigate the textfield to make sure it is specified to be single line (not multiple).  You should also run a trace of A1.length to see if there are any characters you don't expect... should trace "4".  Also try putting traces inside each condition to see if it is always falling into the second condition regardless of your entry in the textfield.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 15, 2012 4:27 AM   in reply to teacheRuss

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points