4 Replies Latest reply on Oct 11, 2010 12:33 AM by Claudino Bur

    Problem determining stage coordinates immediately after scrolling

    Claudino Bur Level 2

      Hello all,

       

      I have a graphical component and I am trying to obtain it's coordinates relative to the stage by using the localToGlobal or contentToGlobal methods.

       

      My problem is when scrolling a Container, these methods do not return the correct values, but return the old unshifted coordinates of the graphical component. Later, after everything seems stable, when trying to use the methods they return correct value so this means at the time where I use them after scrolling
      not all information necessary in computing have been commited.

       

      For the case of the Container class I have investigated and although it passes through the scrollChildren method, the computation is wrong.
      For the case of the Tree component when scrolling with the wheel, the methods return correct value, but when pressing the arrow button of the scroll-bar the methods return incorrect value.

       

      Until now I have tried to listen the scroll and the update complete events when they are dispatched but without any success.

       

      So my problem is that after scrolling I would need to know a moment(event to be listened or something else) that I can call the methods and the output to be ok.I would like the final solution to be uniform.

       

      Did anybody else had this problem? What solution do you recommend me.

       

      Thank you all for your time and patience,
      Claude Bur.

        • 1. Re: Problem determining stage coordinates immediately after scrolling
          Flex harUI Adobe Employee

          Tree uses masking and virtual renderers so it is probably correct, but not

          what you expect.

           

          Container scrolling does have a bug with the stage coordinates.  I think you

          have to wait for ENTER_FRAME

          1 person found this helpful
          • 2. Re: Problem determining stage coordinates immediately after scrolling
            Claudino Bur Level 2

            Hello,

             

            I have tested the ENTER_FRAME event and indeed when computing stage coordinates using those methods, correct results are returned.

             

            I have a component that it "attaches" itself near another component and my component must be a child of the stage. There problem with using the ENTER_FRAME event is that although it is positioned correctly near the other component, the user can observe with the eye a slight delay. I interpret it as because in the ENTER_FRAME phase the screen is allready in a final drawn state, I just react to a screen "after" draw event and not to a screen "before" draw event, which would give me the posibility to alter it by making my own changes.

             

            I have made a test adding those 20-50 events to be listened and I have observed that the first moment where the computation of the stage coordinates is correct is the ENTER_FRAME event. Unless there are other events I have not listened it seems there is no uniform solution to determine the correct

            stage coordinates after a scroll and before the "drawing" to be made on the screen.

             

            Have you other sugestions please?

             

            Thank you for your time,

            Claude Bur.

            • 3. Re: Problem determining stage coordinates immediately after scrolling
              Flex harUI Adobe Employee

              It's been filed as a bug.  I don't know of other solutions.

              • 4. Re: Problem determining stage coordinates immediately after scrolling
                Claudino Bur Level 2

                Thank you for your time and interest.

                 

                Because it may be possible for other to have this problem, my solution (an non-uniform one) was for the Container to manually compute the coordinates based on the contentPane's coordinates after UPDATE COMPLETE event and for Tree to add listeners with lower priority on the scrollbars so that the updating the rows to happen before receiving notification.

                 

                Claude Bur.