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.
var delta:Point = layout.getScrollPositionDeltaToAnyElement(element, elementLocalBounds, entireElementVisible);
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.
<local:Scroller width="800" height="600">
<s:Image id="img" source="@Embed(source='assets/test.jpg')"/>
In the same folder as this mxml file create the folder spark/components and copy the file Scroller.as from the sdk into it. Also copy the spark/styles folder and the file core/version.as. It compiles with no error. Edit scroller.as and the change is seen in the compiled swf.
Thank you so much, that was very helpful to me. Now I just need to modify the file.