An example of as to read an external file to transform it in Array and in html, through SWI. external txt:
CODE
&tot=4&
&song1=1 Name of the mp3& &band1=1 Name of the band & &url1=1 Url of the mp3"&
&song2=2 Name of the mp3& &band2=2 Name of the band & &url2=2 Url of the mp3"&
&song3=3 Name of the mp3& &band3=3 Name of the band & &url3=3 Url of the mp3"&
&song4=4 Name of the mp3& &band4=4 Name of the band & &url4=4 Url of the mp3"&
&done=1&
Swi:
we have to define a variable (des)of dynamic text do not forghet to chech <>

CODE onLoad () { totsong=new Array; // array for the var of txt totband=new Array; toturl=new Array; loadVariables("listmp3.txt"); } onFrame (2,afterPlacedObjectEvents) { // read all variable of txt if (done != "1") { prevFrameAndPlay(); } } onFrame (3) { // write the array i++; des0=eval("song"+i); totsong [i]=des0; des0=eval("band"+i); totband [i]=des0; des0=eval("url"+i); toturl [i]=des0; } onFrame (4) {if (i<tot) {prevFrameAndPlay(); } } //As you see from this script we can add to the various texts the commands html //in this case I have used only the interruption of the line. onFrame (6) {a++; if(a>tot){stop()} else { des=des+"<p>"+totsong[a]+ "</p>"+"<p>"+totband[a]+"</p>"+ "<p> "+toturl[a]+ "</p>"+"<p>"+" "+"</p>"; prevFrameAndPlay(); } }
This is the result

and we can use the var of Array for to do.......................... what one wants to do.
Download Source
|