A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Scroll Back on XML News Feed???

  1. #1
    Chemist
    Join Date
    Oct 2002
    Location
    San Francisco
    Posts
    204

    Scroll Back on XML News Feed???

    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

  2. #2
    Senior Member tupps's Avatar
    Join Date
    Jan 2001
    Location
    Melbourne
    Posts
    2,035
    will:
    newsCount--;
    work?

    You will need to check that newsCount isn't zero to begin with, but that should do the trick.

    Thanks

    Luke
    Flash-XML FAQ
    http://www.tupps.com/flash/faq/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center