0 Replies Latest reply on Apr 28, 2010 9:39 AM by JcFx.Eu

    Bug: Canvas Scrollbar Keeps Jumping to Top

    JcFx.Eu Level 1
      • Working in AS3, compiling against Flex 4 SDK
      • Using a Canvas with a VBox inside it.
      • VBox contains a list of UIComponents.
      • VBox has scrollpolicies off.
      • Canvas has verticalscrollpolicy set to auto.
      • Site uses papervision 3d but this specific component is not part of the 3d space
      • Bug: When I scroll using mouse wheel or arrows, everything works ok. But when I scroll by dragging the thumb button, the scrollbar flickers and keeps jumping back up to the top of the track.


      Here's the code that renders the content:


                  scroller = addChild(new Canvas()) as Canvas;
                  scroller.name = "Scroller";
                  scroller.verticalScrollPolicy = ScrollPolicy.ON;
                  scroller.horizontalScrollPolicy = ScrollPolicy.OFF;
                  inner = scroller.addChild(new VBox()) as VBox;
                  inner.setStyle("backgroundColor", Config.GetColorNumber("appYellow"));
                  inner.name = "Inner";
                  inner.setStyle("verticalGap", 1);

                  for each (var post:Post in posts)
                      var view:BlogPostView = BlogPostView.Fabricate(post, Config); // BlogPostView extends UIComponent
                      view.addEventListener(Event.INIT, handleViewInitialized);
                  //Console.Debug("> " + posts.length);
                  scrollSpacer = new Spacer();
                  scrollSpacer.width = 1;
                  scrollSpacer.height = 40;


      Later, the whole component is laid out. I've checked this function is not being called multiple times or anything like that:


              public override function Layout($xPos:Number, $yPos:Number, $wDim:Number, $hDim:Number):void
                  Console.Debug("BlogPostsView Layout");
                  super.Layout($xPos, $yPos, $wDim, $hDim);
                  for each (var view:BlogPostView in postViews)
                      view.Layout(0, 0, $wDim - 22, 126);
                  scroller.width = this.width;
                   scroller.height = this.height;



      Many thanks in advance for any assistance.