Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Array: Getdata, Load external data into array.
gsb
post May 27 2004, 11:48 AM
Post #1


Regular Dot
Group Icon
Group: *Premier*
Posts: 52
Joined: 22-May 04
From: Seattle
Member No.: 31





PURPOSE:
This Array prototype is used to import vector or array data into a movie parsed into a one or two dimensional array. An optional "isLoaded" method can be defined and executed upon completion.

PROTOTYPE:
Array.prototype.getData = function(url, fieldSeperator) {
this.loader=new LoadVars();
this.loader.data=this;
this.loader.onData=function(s){
var p=s.split('\n'), q;
for(var i=0,k=-1;iif((q=p[i].trim())!="") {
if(typeOf(fieldSeperator)!="string") this.data[++k]=q;
else {
s=q.split(fieldSeperator.charAt(0));
this.data[++k]=new Array();
for(var j=0;j}
}
}
if(typeOf(this.data.isLoaded)=="function")
this.data.isLoaded();
else this.data.isLoaded=true;
};
this.loader.load(url);
};

USAGE: array.getData( URL, fieldSeperator );

EXAMPLE:
myArray = new Array();
myArray.getData( URL, ",");

// OPTIONAL: isLoaded function
myArray.isLoaded=function() {
for(str="",i=0;ifor(j=0;jstr += "myArray["+i+","+j+"] = "+myArray[i][j]+"\n";
str += "\n";
}
gsbTrace( str );
};
 
+Quote Post  Go to the top of the page
*D*
post Jun 5 2004, 12:30 PM
Post #2


Merry KissMoose
Group Icon
Group: Main Team
Posts: 15,990
Joined: 18-May 04
From: North Pole
Member No.: 2





Thankyou Greg for adding this, sincerely appreciated.
 
+Quote Post  Go to the top of the page
Eddie_K
post Jun 5 2004, 01:21 PM
Post #3


Hush now, I'm thinking...
Group Icon
Group: *Premier*
Posts: 3,977
Joined: 25-May 04
From: Heaven
Member No.: 47





*envy* grrr smile.gif

Great example Greg. Thanks for sharing. You eat code for breakfast, lunch & supper I think.

Thumbs up!

Regards,
Eddie
 
+Quote Post  Go to the top of the page
gsb
post Jun 5 2004, 03:13 PM
Post #4


Regular Dot
Group Icon
Group: *Premier*
Posts: 52
Joined: 22-May 04
From: Seattle
Member No.: 31





Yeah.

Newest diet craze, haven't you heard?

"Dr. Gregory's Diet Plan" LOL

gsb
 
+Quote Post  Go to the top of the page
*D*
post Jun 12 2004, 03:54 PM
Post #5


Merry KissMoose
Group Icon
Group: Main Team
Posts: 15,990
Joined: 18-May 04
From: North Pole
Member No.: 2





gsb are you able to edit this yet?
 
+Quote Post  Go to the top of the page
surreal64
post Apr 22 2007, 12:39 AM
Post #6


New Member
Group Icon
Group: Member
Posts: 5
Joined: 20-April 07
Member No.: 15,934





thanks.
 
+Quote Post  Go to the top of the page
Andrew_F
post Nov 5 2009, 03:24 AM
Post #7


New Member
Group Icon
Group: Member
Posts: 20
Joined: 12-April 09
Member No.: 24,863





Very interestin code!!
Thanks a lot!!
 
+Quote Post  Go to the top of the page

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 29th July 2010 - 11:00 PM
Package Holidays | Home Insurance | Property in Egypt | Broadband | Credit Card