# Splitting external Vars to be loaded into an array of objects

**URL:** <https://forum.kirupa.com/t/splitting-external-vars-to-be-loaded-into-an-array-of-objects/55162>\
**Category:** flash\
**Created:** [June 21, 2004, 5:50pm UTC](https://forum.kirupa.com/t/splitting-external-vars-to-be-loaded-into-an-array-of-objects/55162 "2004-06-21T17:50:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BVision](https://avatars.discourse-cdn.com/v4/letter/b/e56c9b/32.png) [@BVision](https://forum.kirupa.com/u/BVision)\
**Post date:** [June 21, 2004, 5:50pm UTC](https://forum.kirupa.com/t/splitting-external-vars-to-be-loaded-into-an-array-of-objects/55162/1 "2004-06-21T17:50:00Z")

</div>

This part loads the vars that I have in my getLinks.txt file.  
[AS]TempLinkLoadVars = new LoadVars();  
TempLinkLoadVars.load(“getLinks.txt”);  
TempLinkLoadVars.onLoad = function() {  
gLinksArray = this.tempLinks.split("|");  
trace(gLinksArray);

};[/AS]  
it works very nicely, but i want to combine both of the sections of code to load my vars into an object that is located in an array.

* * *

this actionscript has objects declared and defined and applied to my allLinks array so I can manipulate them.  
[AS]  
function Link(linkTitle, linkUrl, linkCategory, linkDescription) {  
this.linkTitle = linkTitle;  
this.linkUrl = linkUrl;  
this.linkCategory = linkCategory;  
this.linkDescription = linkDescription;  
}  
allLinks = [];  
allLinks.push(new Link(“Google”, “[http://www.google.com](http://www.google.com)”, “Search”, “Great Search Engine”));  
allLinks.push(new Link(“Yahoo”, “[http://www.yahoo.com](http://www.yahoo.com)”, “Portal”, “Advertisement Central”));  
allLinks.push(new Link(“Ask Jeeves”, “[http://www.aj.com](http://www.aj.com)”, “Search”, “Decent Search Engine”));  
allLinks.push(new Link(“Boundless-Vision”, “[http://www.boundless-vision.com](http://www.boundless-vision.com)”, “Personal”, “My personal website”));  
allLinks.push(new Link(“Kirupa”, “[http://www.kirupa.com](http://www.kirupa.com)”, “Tutorial”, “Great Tutorial Site”));  
trace(“Original data:”);  
for (i=0; i\<allLinks.length; i++) {  
trace(i+" “+allLinks\*.linkTitle+” “+allLinks\*.linkUrl+” “+allLinks\*.linkCategory+” “+allLinks\*.linkDescription);  
}  
allLinks.sortOn(“linkUrl”);  
trace(”  
After sort on linkUrl:");  
for (i=0; i\<allLinks.length; i++) {  
trace(i+" “+allLinks\*.linkTitle+” “+allLinks\*.linkUrl+” “+allLinks\*.linkCategory+” "+allLinks\*.linkDescription);  
}[/AS] ----

Example of what I would like to accomplish …  
where “&” denotes the beginning and end of file.  
where “|” denotes paramaters of each object.  
where “,” denotes the next object of the array eg, link2.

VARS.txt - &link1=link1\_title|link1\_url|link1\_category|link1\_description,link2=link2\_title|link2\_url|etc…&

or something very similar.  
Not quite sure if those are the best var ‘splitters’ or not.

I have not been able to pin this script down… it’s just out of my reach…  
Might be having a bad day…

Thanks For the help!
