No really,

I have a canvas with a floating canvas so the floating canvas never has
scroll bars but the parent does. It's tricky.

This is what I did and it works perfect.


private function updateClientOverlayList():void
{
   var info:OverlayInfo;

   var point:Point;
   var parentPoint:Point;

   var vPosition:Number = 0;
   var hPosition:Number = 0;

   if (currentParent.parent)
   {
       vPosition = Container(currentParent.parent).verticalScrollPosition;
       hPosition= Container(currentParent.parent).horizontalScrollPosition;
   }

   var len:int = clientOverlayList.length;
   for (var i:int = 0; i < len; i++)
   {
       info = OverlayInfo(clientOverlayList[i]);

       var overlay:IOverlay = info.overlay;

       // List
       var client:IUIComponent = info.client;
       // GridCanvas No scroll bars
       var parent:Container = Container(client.parent);
       // RuledCanvas ScrollBars
       var grandParent:Container = Container(client.parent.parent);

       var vm:EdgeMetrics = parent.viewMetrics;
       var vm2:EdgeMetrics = grandParent.viewMetrics;

       var objX:Number = client.x;
       var objY:Number = client.y;

       parentPoint = new Point(
           parent.x, parent.y);

       parentPoint = UIComponent(grandParent).
           localToGlobal(parentPoint)

       overlay.x = parentPoint.x + vm.left + vm2.left +
           (objX * parent.scaleX) - hPosition;
       overlay.y = parentPoint.y + vm.top + vm2.top +
           (objY * parent.scaleY) - vPosition;

       overlay.width = client.width * parent.scaleX;
       overlay.height = client.height * parent.scaleY;
   }
}

That is in a selection manager class.

Peace, Mike

On 7/23/07, dorkie dork from dorktown <[EMAIL PROTECTED]>
wrote:

  Yeah, I'm guessing you used a similar trick. If you know where the
content is going then you can move it there manually using the
lineScrollSize:

            else if (scrollEvent.direction == "vertical") {
                // get scroll sizes. do not use
Application.application.verticalLineScrollSize not accurate on line up
                lineScrollSize = 
event.currentTarget['verticalScrollBar']['lineScrollSize'];


and then check what the user is doing:

                // check what part of the scrollbar user is using
                if (scrollDetail == ScrollEventDetail.THUMB_TRACK) {
                    newPosition = contentTop;
                    _updateScrollInterval++;

                    // prevent update from happening ten times per drag
(update event is generated by scroll)
                    // turned off because it doesn't track - will
investigate another time
                    if (_updateScrollInterval < lineScrollSize) {
                        //return;
                    }

                }
                else if(scrollDetail == ScrollEventDetail.LINE_UP) {
                    newPosition = contentTop + lineScrollSize;
                }

dorkie asking the question dork from dorktown


On 7/23/07, Michael Schmalle <[EMAIL PROTECTED]> wrote:
>
>   Hi,
>
> Thats not the problem.
>
> It even says in the docs, "When the scroll event is dispatched, the
> scrollBar.scrollPosition is in the correct place(obviously) and the
> child content has not been updated."
>
> This is also something that is obvious looking at the framework in
> Container. The scroll event calls invalidateDisplayList(). So this is why
> they say what they say. Nothing in the actual container gets updated until
> updateDisplayList() is called on the next validation pass.
>
> I figured out a workaround for my problem. Since this is a custom
> component, I just subclasses Container and created and event that is
> dispatched at the end of the validateDisplayList() method. Everything works
> fine now.
>
> A note to Adobe developers. For devs like me working at the really low
> level, it would be nice to have an event in the validateDisplayList() area.
> But, that may hit performance.
>
> anyway,
>
> Peace, Mike
>
>
> On 7/23/07, dorkie dork from dorktown < [EMAIL PROTECTED]>
> wrote:
> >
> >   Hi Mike,
> >
> > I ran into this problem too. There is a possible bug??? that gives the
> > incorrect scroll size when using the thumb track.
> >
> > Using the event.detail I was able to find all the information I needed
> > about the scroll event and handle this movement. But I also needed to access
> > additional properties through:
> >
> > ...actually, email me offlist and I'll send you the handler function.
> >
> > dorkie solving the problem dork from dorktown
> >
> >
> > On 7/23/07, Michael Schmalle <[EMAIL PROTECTED]> wrote:
> > >
> > >   Hi,
> > >
> > > This problem has been killing me.
> > >
> > > Here's the scenario;
> > >
> > > We have a container that has scrollbars and a contentPane with
> > > children. When that container scrolls by a scroll bar, a scroll event is
> > > dispatched from the container.
> > >
> > > There can be key or scrollBar events. What is driving me crazy is
> > > that this happens in a separate frame from when updateDisplayList() 
actually
> > > runs to call scrollChildren() and update the scrollRect of the 
contentPane.
> > >
> > > This makes it impossible(as far as I can see) to superimpose and
> > > overlay on top of a container that needs to keep up with any scroll 
position
> > > changes of the target Container.
> > >
> > > I mean, I have x,y,width and height conversions all figured out to
> > > overlay on top but this scroll stuff has wasted about 3-4 days of
> > > investigation.
> > >
> > > Adobe (Alex ;-)), is there anyway to be notified from the outside of
> > > a scroll event ON the frame when the values are correct? I have messed 
with
> > > layoutManager events etc. The problem with trying an updateComplete event 
is
> > > that if the user presses and uses repeat on the scroll buttons, obviously
> > > update complete is not called until things catch up. This causes a lag in
> > > the overlay following the superimposed content.
> > >
> > > Please, some help :) This is the last little glitch I am trying to
> > > iron out.
> > >
> > > Peace, Mike
> > >
> > > --
> > > Teoti Graphix
> > > http://www.teotigraphix.com
> > >
> > > Blog - Flex2Components
> > > http://www.flex2components.com
> > >
> > > You can find more by solving the problem then by 'asking the
> > > question'.
> > >
> >
> >
>
>
> --
> Teoti Graphix
> http://www.teotigraphix.com
>
> Blog - Flex2Components
> http://www.flex2components.com
>
> You can find more by solving the problem then by 'asking the question'.
>
>



--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to