2 Replies Latest reply on Aug 23, 2013 5:44 AM by iDidge

    Random exercise for children - Second round


      After hours and hours pulling my hair off my poor skull I must confess it's a defeat.

      I don't wanna die bald like an egg… so I humbly ask some advice again.


      The code Resdesign gave me works perfectly to display random images as well as to assign it a value.

      That's the IF statement which is a problem! As a matter of fact, it doesn't work at all ;-(

      I don't understand why the variables are not recognized as they are a few lines above…


      I tried to put those damn IF statement all around the symbols and actions (mouseover, click, …and so on) but it does'nt work better!


      Here is the code of compositionReady, needless to say that any help will be warmly welcome!






      //Centrer la scène dans la page




      //Changer la couleur du fond











                    complete: init





                function init() {




                sym.$("PlusGrand").draggable({opacity: 0.35, revert: 'invalid'});

                sym.$("PlusPetit").draggable({opacity: 0.35, revert: 'invalid'});

                sym.$("Egal").draggable({opacity: 0.35, revert: 'invalid'});












                          var myVar = Math.floor((Math.random()*10)+1);

                   var myVar2 = Math.floor((Math.random()*10)+1);

                   //info - verif

                   //var result= myVar;

                   sym.$('info').html('The result is: ' + myVar);

                   //var result2= myVar2;

                   sym.$('info2').html('The result2 is: ' + myVar2);


                          var stage = sym.$("Stage");

                   var symbol1 = sym.createChildSymbol("Symbol_" + myVar, "container1");

                   var symbol2 = sym.createChildSymbol("Symbol_" + myVar2, "container2");














                                    if(myVar > myVar2) {

                                    sym.$('Zone').droppable({accept: sym.$("PlusGrand")}),

                                    alert("Y est!!");


                                    else if(myVar < myVar2) {

                                    sym.$('Zone').droppable({accept: sym.$("PlusPetit")})


                                    else {

                                    sym.$('Zone').droppable({accept: sym.$("Egal")})



        • 1. Re: Random exercise for children - Second round
          YOSHIOKA Ume Level 3

          Hi, iDidge.


          Don't worry. I know a good temple. Let's go to the road to Buddha together.


          BTW. I think ,this part causes the error maybe.


          Edge-Symbol not have the "appendto" method. It's a jQuery-selector's.

          And "createChildSymbol" is a method  for Create & Append. No more need to append again.

          So. this part should be delete.


          Instead, If you want to move symbol1 to stage. write code in this way.


          (but, maybe need to adjust pos.)



          I'm praying for peace of your hair.




          • 2. Re: Random exercise for children - Second round
            iDidge Level 1

            Dear Ume,


            My hair and I we deeply thank you!

            Your post saved my time and the south part of my cranium which would tend to look like the Gobi desert…:-D

            All is OK now and the IF statement works well.

            I'm happy.

            I'm peaceful.

            I smile back to life again.


            Thanks to you