4 Replies Latest reply on May 14, 2010 7:04 AM by TeotiGraphix

    Global Scroll policy

    puddytat5000 Level 1

      Hi

       

      Is it possible to set the scroll policies for all controls globally? or do I have to set them individually for each control?

       

      Thanks

        • 1. Re: Global Scroll policy
          puddytat5000 Level 1

          Hi, any ideas on this?

          • 2. Re: Global Scroll policy
            BhaskerChari Level 4

            You need to set individually for all components there is no other way I guess..

             

             

            Thanx,

            Bhasker Chari

            1 person found this helpful
            • 3. Re: Global Scroll policy
              TeotiGraphix

              Hi,

               

              Each control is it's own instance, so there is no way to set them all at once globally.

               

              You could however listen to the main application's Event.ADDED since it bubbles and check the type of each instance. If it's a container, set the scroll policy for it. In a way this might be global.

               

              <?xml version="1.0" encoding="utf-8"?>
              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                             xmlns:s="library://ns.adobe.com/flex/spark" 
                             xmlns:mx="library://ns.adobe.com/flex/mx" 
                             added="application_addedHandler(event)">
              
                  <fx:Script>
                      <![CDATA[
                          
                          import mx.core.Container;
                          import mx.core.ScrollPolicy;
                          
                          protected function application_addedHandler(event:Event):void
                          {
                              var container:Container = event.target as Container;
                              if (event.target is Container)
                              {
                                  trace("Container " + event.target.id);
                                  container.verticalScrollPolicy = ScrollPolicy.OFF;
                                  
                              }
                          }
                      ]]>
                  </fx:Script>
                  
                  <mx:VBox id="container1">
                      
                      <mx:VBox id="container2">
                          
                      </mx:VBox>
                      
                  </mx:VBox>
                  
              </s:Application>
              
              

               

              You could do the same thing with Groups etc.

               

              Mike

              1 person found this helpful
              • 4. Re: Global Scroll policy
                TeotiGraphix Level 3

                sorry duplicate post