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: Dynamically Loading Files
vandench
Newbie

Posts: 1
Registered: 12/9/2005
Member Is Offline
posted on 12/9/2005 at 05:49 PM Reply With Quote
Dynamically Loading Files


Rather than forcing users to edit the following to add content files

ITEMS = [
{
'file': '../Current_News/cont2.html',
'content': '',
'pause_b': 2,
'pause_a': 1
},
{
'file': '../Current_News/cont1.html',
'content': '',
'pause_b': 2,
'pause_a': 1
}
]


It would be nice to have a loop which would load the ITEMS array dynamically. They would then only have to change some sort of lop counter. Is this possible to do?
View User's Profile View All Posts By User U2U Member
rock
Moderator

Posts: 687
Registered: 4/15/2003
Member Is Offline
posted on 12/10/2005 at 01:17 PM Reply With Quote

Solution for Tigra Scroller download package demo:
Code:

MY_ITEM_NUMBER = 2;
var ITEMS = [];
var l;

for(var j=MY_ITEM_NUMBER; j > 0; j--){
l = ITEMS.length;
ITEMS[l] = {
'file': '../s0_data/cont'+j+'.html',
'content': '',
'pause_b': 2,
'pause_a': 1
}
}



BTW: Nice idea :)
View User's Profile View All Posts By User U2U Member
jeff
Junior Member

Posts: 3
Registered: 6/27/2006
Member Is Offline
posted on 6/28/2006 at 09:36 AM Reply With Quote

How do you implement this dynamic capability? I have never done script coding before so forgive me.
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 6/28/2006 at 11:43 AM Reply With Quote

if you place above code in your scroll.tpl?.js file instead of ITEMS variable definition the scroller will be configured to scroll MY_ITEM_NUMBER of external files named ../s0_data/cont0.html to ../s0_data/cont[MY_ITEM_NUMBER-1].html where [MY_ITEM_NUMBER-1] is actual number. All you need is:
1. place the code in the scroller's config
2. set the number of files you want to scroll
3. fill in directory ../s0_data/ directory with the HTML files sticking to the naming convention
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
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
   

Go To Top


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