Source language: Translate to:

pflash plug

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

pflash plug

Postby SabrinaE » Tue Jan 12, 2010 2:06 pm

hello

i have a program in neobookdb and i have this parameter:

img1="resources/picture1.jpg";
img2="resources/picture2.jpg";
img3="resources/picture3.jpg";
img4="resources/picture4.jpg";

i would like to load this picture in pflash like that:

current=0;
total=4;

function load(){
pf.pf_clearall("pic");
current=current+1;
if(current>total){
current=1;
}
image=img[current] // i would like to have image=img1 ...and image=img2 etc
pf.pf_load("pic",image);
pf.pf_jscallback("pic","onload","onload();");

can i have your help please !
SabrinaE
 
Posts: 182
Joined: Fri Mar 10, 2006 11:51 am

Postby luishp » Wed Jan 13, 2010 1:34 am

You should use Arrays and be carefull calling functions:


pf.pf_createClip("pic");

myarray=new Array();
myarray[1]="resources/picture1.jpg";
myarray[2]="resources/picture2.jpg";
myarray[3]="resources/picture3.jpg";
myarray[4]="resources/picture4.jpg";

current=0;
total=myarray.length-1;

function load(){
pf.pf_clearall("pic");
current=current+1;
if(current>total){
current=1;
}
pf.pf_load("pic",myarray[current]);
pf.pf_jscallback("pic","onload","onload();");
}
function onload(){
pf.pf_align("pic", {verticalCenter:0,horizontalCenter:0});
}
load();
pf.pf_jscallback("pic","onload","onload();");
User avatar
luishp
 
Posts: 359
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby SabrinaE » Wed Jan 13, 2010 2:06 am

luishp wrote:You should use Arrays and be carefull calling functions:

myarray[1]="resources/picture1.jpg";


ok,thank you for the answer, in neobook i have values:

SetVar "[img1]" "c:/resources/picture1.jpg"
SetVar "[img2]" "c:/resources/pictureabc.jpg"
SetVar "[img3]" "c:/resources/pictureasf12.jpg"
... etc

but if I have 100 or 1000 values how to avoid writing all the values in Pflash:

myarray[1]="[img1]";
myarray[2]="[img2]";
myarray[3]="[img3]";
myarray[4]="[img4]";
myarray[5]="[img5]";
myarray[6]="[img6]";
myarray[7]="[img7]";
myarray[8]="[img8]";
......... etc

thank you
SabrinaE
 
Posts: 182
Joined: Fri Mar 10, 2006 11:51 am

Postby luishp » Wed Jan 13, 2010 3:17 am

This is exactly the same for 100 values from 1 to 100:

for(n=1;n<101;n++){
myarray[n]="[img"+n+"]";
}

Take a look to some javascript manual and you will get great results with PFlash.
User avatar
luishp
 
Posts: 359
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Postby SabrinaE » Wed Jan 13, 2010 3:40 am

thank you
SabrinaE
 
Posts: 182
Joined: Fri Mar 10, 2006 11:51 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 4 guests

cron