0 Replies Latest reply on Dec 10, 2014 3:46 AM by norskalf

    Variable is changing.... Is this a bug?


      I am converting playpositions to labels to make it possible to jump from label to label.

      A variable is lost in the process. First it is 1 and then?

      The problem is in bold red below.

      I think it should work!

      Cannot see why not.......


      Please help me out?



      //array of labels

      var labels = ["wasmachine", "grond", "water", "gif", "erosie", "voedsel", "transport", "vervuiling", "energie", "chemicalien", "hennepStart", "hennepGroeit", "bodemverbeteraar", "weinigWater", "Hennep-voedsel", "hennep-energie", "hennep-zonder-vijanden", "hennep-nederland", "stexfibers"]

      var labelPositions =[]


      //fill array with positions of timeline

      for(var i = 0; i<labels.length ; i++)





      sym.mobielSwipe = function(right)



              // working: gives "grond"

             console.log("finds array with content"+labels[1]);


              //working: gives both 19

             console.log("length array labels:" + labels.length +" length array positions:"+labelPosities.length);


             var targetLabel;


              //where is playhead now?

             var currentPosition= sym.getPosition();


             //finding in Array

             var placeInArray = labelPositions.indexOf(currentPosition);


             // finds 0 in array: is still working

             console.log("place in array is:"+placeInArray);


             //var for new place

             var newPlaceInArray;





                  if(right && placeInArray<labels.length-1)


                       newPlaceInArray = placeInArray + 1;


                        //still working... GIVES 1

                       console.log("swipe right and new place is: "+newPlaceInArray+" type is: "+ typeof newPlaceInArray);


                  else if (placeInArray>0);


                  newPlaceInArray = placeInArray-1;





                  newPlaceInArray = 0;





        targetLabel = labels[newPlaceInArray];


      //LOGS: in array is:undefined variabele is : -1

        console.log("in array is:"+targetLabel+" variabele is : "+nieuwePlekInArray);


      handwrited gives "grond"

        console.log("met de hand ingevuld:"+labels[1]);


      //most important action not working