Help with interactive quiz in flash application...

Discussion in 'Web Design and Development' started by Harmush, Mar 13, 2011.

  1. Harmush macrumors 6502a

    Harmush

    Joined:
    Sep 21, 2008
    Location:
    Liverpool
    #1
    Hey guys, having a weird problem with some code i've made. All seems to work fine and the debugger doesnt show anything up. But this is the problem. the code works fine and the flash site is all there and working fine apart from one weird problem.
    If someone could have a look at the code and see if they know what the problem is because i have been through it so much with a tooth comb i can't seem to see the problem.
    Thanks in advance for any help

    I'll attach an image, that will explain the problem better.

    thanks

    PHP:
    stop();
    var 
    questionNo 0;
    var 
    correctAnswer 0;
    var 
    answer 0;
    var 
    selectedOption 0;

    var 
    quiz_question1:Object = {_question"What year was the original Play Station released?"_option1"A. 1994"_option2"B. 1992"_option3"1997"_option4"D. 1990"_answer 1};
    var 
    quiz_question2:Object = {_question"What was the world first video game?"_option1"A. Tennis for Two"_option2"B. Chess"_option3"C. Halo"_option4"D. Pong"_answer2};
    var 
    quiz_question3:Object = {_question"What year was the worlds first video game released?"_option1"A. 1965"_option2"B. 1911"_option3"C. 2004"_option4"D. 1950"_answer4};
    var 
    quiz_question4:Object = {_question"How many home consoles have Nintendo released?"_option1"A. 13"_option2"B. 23"_option3"C. 6"_option4"D. 9"_answer 3};
    var 
    quiz_question5:Object = {_question"In 2007, what was voted 'Best Video Game Ever'?"_option1"A. Half Life 2"_option2"B. Zelda: Ocarina"_option3"C. Tetris"_option4"D. Pong"_answer2};

    var 
    quiz:Array = new Array(quiz_question1quiz_question2quiz_question3quiz_question4quiz_question5);


    function 
    nextQuestion_fn(){
       
    //Check if it is not the last question then display the caption for the button accordingly
       
    if(questionNo quiz.length){
          
    buttonCaption_txt.text "Next";
       }else{
          
    buttonCaption_txt.text "Result";
       }

       
    //Reset the user selection
       
    selectedOption 0;

       
    //Display Question Number
       
    questionNo_txt.text questionNo 1;

       
    //Display Question
       
    question_txt.text quiz[questionNo]._question;

       
    //Display Options
       
    option1_mc.caption_txt.text quiz[questionNo]._option1;
       
    option2_mc.caption_txt.text quiz[questionNo]._option2;
       
    option3_mc.caption_txt.text quiz[questionNo]._option3;
       
    option4_mc.caption_txt.text quiz[questionNo]._option4;
       
    answer quiz[questionNo]._answer;

       
    //Increment the question counter
       
    questionNo++;
    }

    //Create event handler for each option
    function initOptions_fn(){
       for(var 
    1<= 4i++){
          eval(
    "option" "_mc")._id i;
          eval(
    "option" "_mc").onRelease = function(){
             
    selectedOption this._id;
             
    _root.attachMovie("selected_mc""selected_mc"1, {_x:this._x_y:this._y});
          }
       }
    }

    buttonBg_btn.onRelease = function(){
       
    //removes the selected option
       
    selected_mc.removeMovieClip();
       if(
    questionNo quiz.length){
          
          
    //Count the number of correct answer
          
    if(answer == selectedOption){
             
    correctAnswer++;
          } 

          
    //Display the next question
          
    nextQuestion_fn();
       }else{
          
    gotoAndStop("Result",1);
       }
    };

    initOptions_fn();
    nextQuestion_fn();
    The attached image is the case for each member of the array? Can't figure it out, why only certain, seemingly random parts of the string are being removed? If anyone could help that would be great.
     

    Attached Files:

  2. designguy79 macrumors 6502

    Joined:
    Sep 24, 2009
    Location:
    Michigan
    #2
    Check to see what characters are being embedded in Flash. By default, it will only embed the ones used initially, so if you dynamically change them, it can cause this.

    What version of Flash are you using?
     
  3. Harmush thread starter macrumors 6502a

    Harmush

    Joined:
    Sep 21, 2008
    Location:
    Liverpool
    #3

    I'll check this. Will embedding the whole font fix this?
     
  4. designguy79 macrumors 6502

    Joined:
    Sep 24, 2009
    Location:
    Michigan
    #4
    Why is that? I guess I am not following your train of thought, sorry!

    It should, yes, but I would only embed certain subsets to keep it smaller. Flash will let you choose sets like, a-z, A-Z, 0-9, etc.
     
  5. Harmush thread starter macrumors 6502a

    Harmush

    Joined:
    Sep 21, 2008
    Location:
    Liverpool
    #5
    Done and it works, just embedded the basic latin. 95 glyphs and its fine now thanks.
     

Share This Page