views:

24

answers:

1

Hi,

I've got an <mx:Button> in my application, I have 10 items in an XML Node. What I'd like to do is when the button is clicked show the next 5 XML Nodes.

How do I achieve this?

My code is as follows at the mo :

<mx:Button x="1380.65" y="582.65" styleName="rightButton"/>

The style is just setting the up / over and down states of the button. But I want it to function and show the XML nodes in groups of 5.

+2  A: 

How are you displaying the first five items?

If you're displaying things in a list or DataGrid, I believe you can set the verticalScrollPosition to scroll the list via a button click.

If you are displaying items using TextInputs, custom component, or other non-renderer-based classes, you just need to manually write some code to update the display elements based on the currently displayed index and what is next.

Can you offer a running sample? That may us direct you!

www.Flextras.com
Yeah, its in a HorizontalList.I havent got an running sample as such, its all running locally due to me working with a database and others.Can provide the HorizontalList properties tho
StuBlackett
Just an update.. I've set an protected function button1_clickHandler(event:MouseEvent):void { // Handle the button videoArea.horizontalScrollPosition = 10000; videoArea.liveScrolling = true; }But thats just nudging the box over, rather than the items?
StuBlackett
Take your code, give it a hard coded dataProvider to remove backend dependency and give us a simple sample. I'm pretty sure that liveScrolling scrolls on a pixel by pixel basis. I thought with it off, the list should scroll on an item by item basis. Otherwise you can do some math based on columnWidth property
www.Flextras.com
Thanks for the tips Flextras.com seems to work. set the VerticalScrollPosition to 5 and it scrolls through. Just need to do the maths to work out how many items are in the XML etc. Sounds fun =/
StuBlackett