5 Replies Latest reply on Oct 9, 2013 7:21 AM by vijayveluru

    how to create the mouse over and out events for dynamic buttons

    vijayveluru

      Hi its very urgent ...

       

       

      myBtn.$("txt").click(function(){

       

      });

      myBtn.getSymbolElement().css({position:'absolute', display:'inline-block', top:yPos, left:xPos});

        • 1. Re: how to create the mouse over and out events for dynamic buttons
          resdesign Adobe Community Professional & MVP

          We probably need more information if you want very specific answers.

          I would use mouseenter and mouseleave for these events.

          mousevents.jpg

          • 2. Re: how to create the mouse over and out events for dynamic buttons
            vijayveluru Level 1

            i have created  10 buttons in dynamically  on Stage. please check once this code.

             

             

            namesArray = ['one','two','three','four','five','six','seven','eight','nine','ten']  

             

                       var x = imageArray[stageObj["rand"]]

             

                        for (var i=0; i < namesArray.lenght - 1; i++)

                            {

                                var myBtn = sym.createChildSymbol("btn", "Stage");

             

                                 myBtn.$("txt")[0].innerHTML = namesArray[i]

             

                                  myBtn.$("txt").click(function(){

             

                                   /////////     here i have to write events for when i move the cursor on the  buttons  its show thubnail and remove cursor from the buttons its  normal

             

                                   if (stageObj["rand"] == (i+1)) {

                                         console.log('Correct')

                                         console.log("$$$$$$$$$$" + (stageObj["optionsArr"].indexOf(myBtn)+1))

                                         stageObj["getGame"]();

                            }

                            else

                            {

                                console.log("incorrect")

             

                                //stageObj["optionsArr"][stageObj["rand"]-1]

                            }

             

                        });

             

                       ///here i have created positions for buttons

             

                        myBtn.getSymbolElement().css({position:'absolute', display:'inline-block', top:yPos, left:xvalues[i]});

             

             

             

            ----------------------

            Thanks

            • 3. Re: how to create the mouse over and out events for dynamic buttons
              resdesign Adobe Community Professional & MVP

              typo in your code:

               

              for (var i=0; i < namesArray.lenght - 1; i++) {

               

              should be:

              for (var i=0; i < namesArray.length - 1; i++) {

               

               

              You need to pay attention to the alert for errors in your code and  correct them.

              code error.png

              code error 2.png

              • 4. Re: how to create the mouse over and out events for dynamic buttons
                resdesign Adobe Community Professional & MVP

                Other possible errors in your code - use quotation marks for the property names and values (unless number).

                 

                myBtn.getSymbolElement().css({

                'position':'absolute',

                'top':yPos,

                'left':xvalues[i]

                });

                1 person found this helpful