2 Replies Latest reply on Jun 1, 2009 9:29 PM by yancaoshi

    rollOut event seems not been caught, why???

    yancaoshi

      Hi all,

       

      I need this effect. When mouse is over the image, I need to enlarge it while out, shrink back to normal size. But if mouse is quickly moved out, the rollOut event is not caught. Any solution on this?

      Code here:

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Resize id="myResize" />

      <mx:Script>
              <![CDATA[
                      public function rollOverHandler():void{
                              imgViewer.width = imgViewer.width * 1.1;
                              imgViewer.height = imgViewer.height * 1.1;
                      }
                     
                      public function rollOutHandler():void{
                              imgViewer.width = imgViewer.width / 1.1;
                              imgViewer.height = imgViewer.height / 1.1;
                      }
              ]]>
      </mx:Script>
      <mx:Image id="imgViewer" x="140" y="46" width="272" height="270" resizeEffect="myResize"
              source="dolaemoney.jpg" rollOver="rollOverHandler()" rollOut="rollOutHandler()"/>
             
      </mx:Application>

        • 1. Re: rollOut event seems not been caught, why???
          CoreyRLucier Adobe Employee

          It's most definitely getting handled (the rollOut that is)... replace your code with the following:

           

                          public function rollOverHandler():void{
                              trace("rov");
                                  myResize.stop();
                                  imgViewer.width = 400;
                                  imgViewer.height = 400;
                          }
                        
                          public function rollOutHandler():void{
                                  trace("ro");
                                  myResize.stop();
                                  imgViewer.width = 270;
                                  imgViewer.height = 270;
                          }

           

          Note the 'ro' trace message occurs each time you roll out.  You'll just need to play with the mechanics of the resize effect to get things behaving the way you wish.

          • 2. Re: rollOut event seems not been caught, why???
            yancaoshi Level 1

            Hi,

             

            You give the right key to this question.

             

            Thanks,