02-08-2011 06:02 AM
I have a doubt in how ScrollPane works.
The objects(containers) situaded out of the screen in the scroll pane(not visible yet),are yet drawn o they will be drawned when will be visible(after a scrolling)?
I want to load an image in a container when the container itself is on the screen.my first idea was to override the method draw,but i think that the container outside the screen mbut yet setting inside the scrollpane,are yet drawned,i would like to add image only when,during a scrolling,they will be visible on screen.i tried also with onAdded,but on Added is activated when you add the item inside another,and so at the beginning.
I hope i have explain the problem well,but i doubt it
02-08-2011 07:16 AM
I just added a scrollpane to my app so I have a tiny idea how things work. When using one, you setup an area on the screen where you want it. Then you take your (possibly) oversized object and put it in it (so to speak). What fits will be shown. What doesn't fit can be scrolled into view. There are horizontal and vertical scrollbars (sort-of) that show up while scrolling the object. The nice thing about the scrollpane is you don't have to "sweat the small things". Just pretend you have an infinite canvas to draw into and let it handle what actually displays.
02-08-2011 07:22 AM
thanks for the response.
i know it,what i would like to know is if the object outside the real dimension of the screen(stage),are yet draw or they will be drawned when they are inside the stage.If they are already drawned,is there a method that intercept when the object reach visibility on screen?My first try was after a scrollEnd,it works,but i need it during the scrolling.
02-08-2011 07:40 AM
Any good rendering engine will not attempt to draw anything that won't be seen. So if you have an object that is completely outside the scollpane, it should skip it and go onto the next one.
I don't know if there are any events for when an object is rendered or not. If I had to do it. I'd track the location of my object inside the scrollpane to see when it was inside of it. I think you can get the current scroll position from the scrollX and scrollY properties.