0 Replies Latest reply on Jun 25, 2014 9:40 AM by ZaptEditora

    Conditions --- IF - ELSE IF

    ZaptEditora

      Help me - I created an object where the girl in the photo and asks for the correct track number. When we entered the correct number, it keeps going until the next issue.

       

      I wonder, how could it do, if dragged the incorrect number, activates an audio Incorrect or try again.

       

      I am using the code below but I can not imagine how to do this if - else if, as I am now starting to edge and jquery.

       

      Thank you very much.

       

      --------

       

      // make an array of the draggable symbol names

      draggableEl = ['_13','_17','_21','_26','_31','_35'];

      // make an array of the droppable element names

      droppableEl = ['_13target','box17','box21','box26','box31','box35'];

      // have only the first element be draggable

       

       

      // set up the droppable to accept each draggables

      for (i=0;i<droppableEl.length;i++){

        sym.$(draggableEl[i]).addClass('C'+i);

        sym.$('.C'+i).draggable({

        revert: 'invalid'

      });

        sym.$(droppableEl[i]).droppable({

        accept:'.C'+i,   // use class for accept

        drop: handleDropEvent

        });

       

      }

       

      k=0;

       

       

      function handleDropEvent(event, ui){

          ui.draggable.draggable( 'disable' );

          $(this).droppable( 'disable' );

          // place draggable where needed. could be left, top

         // ui.draggable.position( { of: $(this), my: 'left', at: 'top' } );

          ui.draggable.position( { of: $(this), my: 'center', at: 'center' } );

          ui.draggable.draggable( 'option', 'revert', false );

          k++;

          if (k==1){

          sym.getSymbol('correct').play();

       

          // play animation here.

          }

       

      }

      Screen Shot 2014-06-25 at 1.33.36 PM.png