6 Replies Latest reply on Nov 29, 2012 7:55 AM by joel_pau

    touchstart button problem

    boxofspiders Level 1

      Hi,

       

      I posted something about this problem before but thought it might be better to repost with some code examples as this problem is driving us crazy!

       

      In a test widget build for iBooks we have a 'check answers' button which should reveal either a cross or a tick depending on whether the answer entered into a text field is correct or not .. the button then also hides itself and shows a reset question button.

       

      The problem is that when the widget is run on an iPad to make the functionality work you have to keep your finger held on the button which is not ideal ..

       

      Here is the code for the check answers button:

       

      .touchstart

      //sets all the Questions to check mode too
      //make sure we pick up only questions
      var PageDiv = sym.getSymbolElement("Page")
      var pageChilds = sym.getChildSymbols(PageDiv);
      
      var theclass = $(sym).attr("class");
      
      for (i=0; i<pageChilds.length; i++){
                var QuestionDiv = pageChilds[i].getSymbolElement("Question")
      
                var QChilds = sym.getChildSymbols(QuestionDiv);
      
                var QClass = $(QuestionDiv).attr("class");
      
                if (QClass == "Question"){
                          // playFrom test to check
                          pageChilds[i].play("test"); 
                }
      }
      
      //make sure the right button is showing as sometimes the other one decides to appear when its not wanted
      sym.$("ResetButton").show();
      sym.$("AnswerButton").hide();
      

       

      And the code for the reset questions button:

       

      .touchstart

      //sets all the Questions to check mode too
      //make sure we pick up only questions
      var QuestionsDiv = sym.$("Questions");
      var childQuestions = sym.getChildSymbols(QuestionsDiv);
      var theclass = $(QuestionsDiv).attr("class");
      
      for (i=0; i<childQuestions.length; i++){
                //get only this question
                childQuestions[i].play("init"); 
      }
      
      //make sure the right button is showing coz sometimes the other one decides to appear when its not wanted
      sym.$("AnswerButton").show();
      sym.$("ResetButton").hide();
      

       

       

      Both buttons have the same problem yet in a desktop browser the whole thing works fine ..

       

      Any suggestions would be greatfully received, thanks for reading!