Working with Methods in Flow List: Next and Previous Item buttons
Updated: Apr 22, 2008
Views: 1698
Description: This tutorial will show you how to use buttons to call methods of the Flow List that will the select next and previous items in Flow List and buttons that call next and previous pages of the Flow List.
Complete Code:
next_btn.onRelease = function() {
myFlow.selectNextItem();
}
prev_btn.onRelease = function() {
myFlow.selectPreviousItem();
}
myFlow.selectNextItem();
}
prev_btn.onRelease = function() {
myFlow.selectPreviousItem();
}
Set-Up and Add Content Using through XML
Before you begin make sure that you have successfully installed the component inspector have been able to load content into the Flow List component using XML. Also make sure that you give your Flow List an instance name of myFlow.
Please make sure that you have added your target URL's into the data tag in your XML document for all your items.
Understanding the Plan for ActionScript
We will use a little ActionScript to connect these buttons to the Flow List.
- First we want to add a mouse event listener for when our next image button is clicked and then in function that is called reference a method of our Flow List component which selects the next item.
- Likewise, we want to add a mouse event listener for previous image button is clicked and reference a method that will select our previous item in our Flow List component in the function that our event listener calls.
As noted in our plan, we create an event listener for when our button that created to move forward is clicked. In this event listener we call a function that calls a method of our Flow List which selects the next item.
next_btn.onRelease = function() {
myFlow.selectNextItem();
}
myFlow.selectNextItem();
}
Selecting Previous Item in the Flow List with a Button
For the previous item we proceed similar to the next item except reference our other button, call a different function, and use the select previous item method of our Flow list.
prev_btn.onRelease = function() {
myFlow.selectPreviousItem();
}
myFlow.selectPreviousItem();
}
Other Tutorials
