Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Harmush

macrumors 6502a
Original poster
Sep 21, 2008
557
3
Liverpool
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", _answer: 2};
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", _answer: 4};
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", _answer: 2};

var quiz:Array = new Array(quiz_question1, quiz_question2, quiz_question3, quiz_question4, quiz_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 i = 1; i <= 4; i++){
      eval("option" + i + "_mc")._id = i;
      eval("option" + i + "_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.
 

Attachments

  • Screen shot 2011-03-14 at 00.46.20.jpg
    Screen shot 2011-03-14 at 00.46.20.jpg
    23.7 KB · Views: 178
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?
 
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?


I'll check this. Will embedding the whole font fix this?
 
dynamic change of characters under these conditions is anyway not a great practise..

Why is that? I guess I am not following your train of thought, sorry!

Will embedding the whole font fix this?

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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.