Quantcast
Channel: Adobe Community : All Content - Edge Animate
Viewing all articles
Browse latest Browse all 9897

Random exercise for children - Second round

$
0
0

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!

Thanks!

iDidge

 

=======================

 

//Centrer la scène dans la page

$("#Stage").css({margin:"auto"});

 

 

//Changer la couleur du fond

//$("#Stage").css({backgroundColor:"orange"});

 

 

yepnope(

          {

              nope:[

                'js/jquery-ui-1.10.3.custom.min.js',

                'js/jquery.ui.touch-punch.min.js',

                //'css/jquery-ui-1.9.2.custom.min.css'

                ],

              complete: init

          }

          );

 

 

          function init() {

 

 

                                //Draggable

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

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

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

 

 

 

 

 

 

 

 

                    //Random

 

 

                    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);

             //Create

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

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

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

             //Append

             symbol1.appendto(stage);

             symbol2.appendto(stage);

 

 

 

 

 

 

                              //Droppable

 

 

 

                              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")})

                              }

}


Viewing all articles
Browse latest Browse all 9897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>