Skip to main content
Participating Frequently
July 30, 2009
Question

scrolling a ContainerController?

  • July 30, 2009
  • 1 reply
  • 1634 views

I'm curious what's not working here. Any pointers appreciated. The slider is being used to set any value on the ContainerControllers, but vertical scrollPosition is always reported back as 0. Thanks,


private function init():void {
   
    XML.ignoreWhitespace = false;
    textFlow = TextFlowUtil.importFromXML(textXML, TextConverter.TEXT_LAYOUT_FORMAT);
   
    tsprite = new Sprite();
    tsprite.x = 0;
    tsprite.y = 20;
    textHolder.addChild(tsprite);
    var tcc:ContainerController = new ContainerController(tsprite, 500, 400);
    textFlow.flowComposer.addController(tcc);
   
    bsprite = new Sprite();
    bsprite.x = width/2;
    bsprite.y = 20 + (height/2);
    textHolder.addChild(bsprite);
    var bcc:ContainerController = new ContainerController(bsprite, 500, 400);
    textFlow.flowComposer.addController(bcc);
   
    addElement(textHolder);
   
    textFlow.interactionManager = new EditManager(new UndoManager());
    textFlow.flowComposer.updateAllControllers();
    textFlow.interactionManager.selectRange(0, 0);
   
    invalidateDisplayList();
}

protected function sliderChange():void {
   
    for(var i:int = 0; i<textFlow.flowComposer.numControllers; i++) {
        var controller:ContainerController = textFlow.flowComposer.getControllerAt(i)
        controller.verticalScrollPosition = scrollSlider.value * 10;
    }
    //textFlow.flowComposer.updateAllControllers();
}

This topic has been closed for replies.

1 reply

Participating Frequently
July 30, 2009

Hi,

I'm not sure if they explain what your are observing, but two things to note are:

- The scroll policies for all but the last container are treated as OFF. If scroll policy is OFF, scroll position has no effect.

- For the last container (assuming scroll policy is ON/AUTO), scroll position has an effect only if text overflows it.

Abhishek

(Adobe Systems Inc.)

Participating Frequently
July 30, 2009

Thanks for the help. Ok, so, yeah, even by doing this:

tsprite = new Sprite();
tsprite.x = 0;
tsprite.y = 20;
textHolder.addChild(tsprite);
               
var tcc:ContainerController = new ContainerController(tsprite, 500, 400);
tcc.verticalScrollPolicy = ScrollPolicy.ON;
textFlow.flowComposer.addController(tcc);
               
bsprite = new Sprite();
bsprite.x = width/2;
bsprite.y = 20 + (height/2);
textHolder.addChild(bsprite);
var bcc:ContainerController = new ContainerController(bsprite, 500, 400);
bcc.verticalScrollPolicy = ScrollPolicy.ON;
textFlow.flowComposer.addController(bcc);
               
addElement(textHolder);

i.e. setting both ContainerControllers scrollPolicy to ON, only the last scrolls. Any way to scroll the text across the two containers? When I delete text from the top container, it flows across both without a hitch, it's scrolling that seems to be the tricky thing.

Participating Frequently
July 30, 2009

Sorry, scrolling through multiple containers is not supported. Any text that does not fit in the first or intermediate containers will flow to the next one. Only the last one will scroll (if scorlling is enabled and text overflows it).