13 Replies Latest reply on Sep 9, 2010 8:06 AM by Maximist

    How to enable Mouse Scroll in List

    Maximist Level 1

      Hallo. I have a list and i can scroll it throw scroller or throw arrows (on keyboard), but how can i scroll all the elements with the mouse scroller??.. By default it doesn't work, how can i enable it?

       

      Thx

       

      Max

        • 1. Re: How to enable Mouse Scroll in List
          Arun Ganesh Level 3
          Hi,
          Try this


          private function onMouseWheel( evt:MouseEvent ) : void
                      {
                        
                          var curScrollPos:Number = myList.verticalScrollPosition;
                          if (curScrollPos> 0 && curScrollPos< myList.maxVerticalScrollPosition)
                          {
                              curScrollPos+= evt.delta;
                          }
                          myList.verticalScrollPosition = curScrollPos;   
                      }


          <mx:List mouseWheel="onMouseWheel(event)" id="myList"/>
          • 2. Re: How to enable Mouse Scroll in List
            Maximist Level 1

            Thx for help. I tried your code, but there is no property in my list named verticalScrollPosition...

             

            Why??

             

            Max

            • 3. Re: How to enable Mouse Scroll in List
              Arun Ganesh Level 3

              Hi,

              There is a property called 'verticalScrollPosition'.

              Can u share ur code here? I may find where the issue is?

              • 4. Re: How to enable Mouse Scroll in List
                Maximist Level 1

                Ok.. This is my List component:

                 

                <s:List id="listaAreeBusiness_conces_lst" width="80%" height="82%" borderVisible="false" top="35" skinClass="skins.mioList_skin" horizontalCenter="0">

                 

                When i try to do:

                 

                this.listaAreeBusiness_conces_lst.verticalScrollPosition

                 

                i receive a compile error which says that there is no property with name verticalScrollPosition... This is true also because, when i use the assist tool, i see all the properties and there is no verticalScrollPosition property... I don't understand why..

                 

                please help me...and thx for all

                 

                Max

                • 5. Re: How to enable Mouse Scroll in List
                  Arun Ganesh Level 3

                  Are you working on Spark list?

                  If it is means try,

                   myList.layout.verticalScrollPosition
                  • 6. Re: How to enable Mouse Scroll in List
                    Maximist Level 1

                    Ok...

                     

                     

                    myList.layout.verticalScrollPosition

                    Works fine for me... finally
                    
                    
                    But i can't find this other property you wrote in the code: maxVerticalScrollPosition

                    Where is this property??.. 

                    Thx

                    Max
                    • 7. Re: How to enable Mouse Scroll in List
                      Arun Ganesh Level 3

                      You can use your dataprovider length instead of maxVerticalScrollPosition

                      • 8. Re: How to enable Mouse Scroll in List
                        Maximist Level 1

                        Ok, now i don't receive any error message from compiler, but, when i run the program and use the mousewheel, nothing happen... absolutly nothing.. I paste here the code i am using so that u can correct:

                         

                        this is my list:

                         

                        <s:List id="listaUtentiFacebook_conces_lst" width="80%" height="82%" change="cambioItemAmiciFB_conces_Handler(event)" borderVisible="false" top="35" skinClass="skins.mioList_skin" horizontalCenter="0" mouseWheel="onMouseWheel(event)">

                         

                        <s:layout>

                                  <s:VerticalLayout gap="3"/>

                        </s:layout>

                         

                         

                        <s:itemRenderer>

                             <fx:Component>

                                  <componenti:mioItemRenSoloTesto mioCampo="name"/>

                             </fx:Component>

                        </s:itemRenderer>

                         

                         

                        </s:List>

                         

                         

                        And this is my script code:

                         

                        private function onMouseWheel( evt:MouseEvent ) : void

                        {

                                  var curScrollPos:Number = this.listaUtentiFacebook_conces_lst.layout.verticalScrollPosition;

                                  if (curScrollPos> 0 && curScrollPos< this.listaUtentiFacebook_conces_lst.dataProvider.length)

                                  {

                                       curScrollPos+= evt.delta;

                                   }

                                   this.listaUtentiFacebook_conces_lst.layout.verticalScrollPosition = curScrollPos;

                        }

                         

                        What is my mistake??

                         

                        Thx

                         

                        Max

                        • 9. Re: How to enable Mouse Scroll in List
                          Maximist Level 1

                          I have just a new for you... I watched the help about the event mouseWheel and it says:

                           

                          Dispatched when a mouse wheel is spun over an InteractiveObject instance. If the target is a text field, the text scrolls as the default behavior. Only available on Microsoft Windows operating systems.

                           

                          Uhm.... I can use this event only with Microsoft Windows???... If yes, now i understand why it doesn't work for me.. I have a Mac... There is not a way with Mac??.. Is that possible??

                           

                          Thx

                           

                          Max

                          • 10. Re: How to enable Mouse Scroll in List
                            Arun Ganesh Level 3

                            trace the value of evt.delta, curScrollPos and let me know. I don't have flex 4 on my machine. thats the problem.

                            • 11. Re: How to enable Mouse Scroll in List
                              Maximist Level 1

                              Did you see my last message??... I have a Mac and maybe it is because of this that i have problems... I tried to trace the mouseWheel event but i don't get eny trace...it is like this event never happen... and this is because your code doesn't work... Maybe is The Mac the problem..

                               

                              Max

                              • 12. Re: How to enable Mouse Scroll in List
                                Arun Ganesh Level 3

                                Now only check that message.

                                Stange one. Adobe have to fix that one.

                                1 person found this helpful
                                • 13. Re: How to enable Mouse Scroll in List
                                  Maximist Level 1

                                  Yeah, i think too... Thx for all anyway and good work

                                   

                                  Max