Thursday, 20 October 2011

Week 5 cont..

Text Entry Question (updated)



Hurmm....masalah yang sy hadapi ialah answer y case sensitive - kalau answer "nose" betul tapi kalau answer "Nose" salah..
    Masih mencari solusinya..any idea frenz?


    Step by step:

    1. Bina beberapa layer mengikut keperluan.
    2. Gunakan Static Text untuk soalan, Input Text (var : answer) untuk ruang jawapan daripada pengguna dan Dynamic Text (var : respon) untuk respon kepada jawapan pengguna.


    3. Bina layer stop dan masukkan actionscript :
            var respon;
            var answer;
            respon = ""
            answer = ""
            stop();

    4. Bina layer button, masukkan Check Button dan Next Button.
    Actionscript untuk Check Button :
    on (release, keyPress "<Enter>") {if (answer.toLowerCase()== "nose") {respon="Correct! Good job.";
                    }else{
                    respon="Incorrect. Your answer " + answer + " is incorrect.";
    }
    }
    Actionscript untuk Next Button :
    on (release) {gotoAndPlay("Scene 2", 1);

    }
    5. Test movie

    7 comments:

    1. haha...i enjoy playing with this program...

      nice one...

      for your question about the Big N and small n tu, well i guess one has to specify it at the actionscript...maybe u can have "if else" setting there...but tell you what, i'm not really good in that...
      haha, maybe Ashikhin can lend a help here...i think she's good with programming...hehe...

      but, i will try to search and do it first and i'll get back to you later ok...

      ReplyDelete
    2. Kreatif la u ni, mesti anak2 murid suka test latihan ni :)

      Tentang case sensitive problem tu, Syakira cuba add toLowerCase() kat sebelah answer dalam Actionscript setting tu.

      Hope that helps ;)

      ReplyDelete
    3. yea, just check her blog...it is worth to drop by...
      and Norzie you have just save my time...hehe

      ReplyDelete
    4. saya ada try n error guna if - else if - else statement..so far alhamdulillah jadi.TAPI coding terlalu panjang sbb kena letakkn beberapa condition.

      saya tgh try coding lowercase n uppercase yang Norzie berikan.

      Kalau success akan diberitahu kelak yer..

      Doakn sama2.:)

      ReplyDelete
    5. Hurmm..xfaham & xdapat buat..
      Norzie,ieja & kak shikhin, kat bahagian mana y nak add toLowerCase()?
      ni actionscript saya..

      on (release, keyPress "") {if (answer == "nose") {respon="Correct! Good job.";
      }else{
      respon="Incorrect. Your answer " + answer + " is incorrect.";
      }
      }

      TQ..

      ReplyDelete
    6. do like this one:

      on (release, keyPress "") {if (answer.toLowerCase()== "drives"){respon="Hooray! CORRECT!";
      } else {
      respon="Incorrect. Your answer " + answer + " is incorrect";
      }
      }


      bole refer blog norzie utk pemahaman lanjut ok

      ReplyDelete