Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Randomizing the order of the scrolling items
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 1/3/2006 at 07:09 PM Reply With Quote
Randomizing the order of the scrolling items


Below function will shuffle the scroller items:

Code:

function random_items (a_source) {
var n_index, a_items = [];
while (a_source.length) {
n_index = Math.ceil(Math.random() * a_source.length) - 1;
a_items[a_items.length] = a_source[n_index];
a_source[n_index] = a_source[a_source.length - 1];
a_source.length = a_source.length - 1;
}
return a_items;
}


It can be used like this:

Code:

new TScroll_init (Tscr_LOOK, Tscr_BEHAVE, random_items(Tscr_ITEMS));
View User's Profile View All Posts By User U2U Member
yaya20
Junior Member

Posts: 2
Registered: 3/16/2006
Member Is Offline
posted on 3/16/2006 at 05:38 PM Reply With Quote

I've been trying to find a way to do this and what you pose is much simpler than what I was trying to do...

In what file do I need to put the random function? And where/how do I call it correctly?
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 3/16/2006 at 10:49 PM Reply With Quote

The function can be inserted in .js file or inside the <script> tag anywhere obove the place where it is first called. See the call example in the initial post.
View User's Profile View All Posts By User U2U Member
yaya20
Junior Member

Posts: 2
Registered: 3/16/2006
Member Is Offline
posted on 3/17/2006 at 03:09 AM Reply With Quote

Thanks. After some work I got it functioning.
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Tigra Scroller
Product Demonstrations Live Demos:
Multiple vertical scrolling
Horizontal scrolling
Free Download Free Download
Product Documentation Documentation:
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
   
Tigra Scroller PRO
Product Demonstrations Live Demos
Vertical automatic scrolling
Horizontal manual scrolling
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004