2 Replies Latest reply on Nov 25, 2011 8:09 AM by pcoyne1979

    Problem creating a Flex 4.5 mobile Scroller

    pcoyne1979 Level 1

      I have created a 'new' Scroller component by copying all the code from the spark Scroller into a new actionscript file, renaming it, updating import statements and adding any files I need to include to the local directory. I'm having to do this because I need to change something in a private method and basically I don't know any other way.

       

      Everything seem to work fine except a couple of lines in the ensureElementPositionIsVisible method.

       

      This one

       

          var delta:Point = layout.getScrollPositionDeltaToAnyElement(element, elementLocalBounds, entireElementVisible);

       

      and

       

           var eltBounds:Rectangle = layout.getChildElementBounds(element);

       

      I am getting these errors 'Call to a possibly undefined method getChildElementBounds', and 'Call to a possibly undefined method getScrollPositionDeltaToAnyElement'. There is a little bit of code before this that sets the layout variable to either a GroupBase layout object or SkinnableContainer layout object.

       

           if (viewport is GroupBase)

                           layout = GroupBase(viewport).layout;

           else if (viewport is SkinnableContainer)

                           layout = SkinnableContainer(viewport).layout;

       

      My hunch is that there is a problem with the viewport not being defined somehow, or possibly the skin. If anyone knows how I can fix this so that I can change the Scroller classes private methods, then I would be truly grateful.