I can scroll forward to the next title and link, but is there a way to have a button to scroll back?
This is my code:
Code:
trace(_root.newsItems.length);
if (Number(_root.newsItems.length) == 0) {
//This allows us to wait until our arrays have been initilised properly!
gotoAndPlay(2);
} else {
//Pick a random news item to display.
newsCount = random(_root.newsItems.length);
//Check to make sure that the old news item is not the same as the current one.
if (newsCount == oldCount) {
if (newsCount == _root.newsItems.length - 1) {
//If the last element has been repeated, we should choose the first one.
newsCount = 0;
} else {
//Just go to the next news Item.
newsCount++;
}
}
//Get the newsitem that has been randomly choosen
nextNewsItem = _root.newsItems[newsCount]
trace("newsCount: " + newsCount + " DisplayName: " + nextNewsItem.DisplayName + " URL: " + nextNewsItem.URL);
//NewsLine is the text that the user sees.
NewsLine = nextNewsItem.DisplayName;
//Hit Url is the URL that the user will be sent to when they click on the hitButton
//Which is the invisible top layer
hitURL = nextNewsItem.URL;
//Old Count is a way of keeping track of the last items and is used to
//Check that we don't get repeats in our code.
oldCount = newsCount;
}
Thanks a lot!
/zach