# Do/while loop to fill an array until all the variables have been loaded

**URL:** <https://forum.kirupa.com/t/do-while-loop-to-fill-an-array-until-all-the-variables-have-been-loaded/25789>\
**Category:** Uncategorized\
**Created:** [July 16, 2003, 3:13pm UTC](https://forum.kirupa.com/t/do-while-loop-to-fill-an-array-until-all-the-variables-have-been-loaded/25789 "2003-07-16T15:13:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimboxl](https://avatars.discourse-cdn.com/v4/letter/j/e99b99/32.png) [@jimboxl](https://forum.kirupa.com/u/jimboxl)\
**Post date:** [July 16, 2003, 3:13pm UTC](https://forum.kirupa.com/t/do-while-loop-to-fill-an-array-until-all-the-variables-have-been-loaded/25789/1 "2003-07-16T15:13:31Z")

</div>

OK I figured that I could possibly do a do/while loop until all of the variables in my text file are loaded. My question is, what condition would be used to keep the loop going until all the variables have been loaded? The variables would have a name like var1, var2, var3, etc…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 16, 2003, 4:02pm UTC](https://forum.kirupa.com/t/do-while-loop-to-fill-an-array-until-all-the-variables-have-been-loaded/25789/2 "2003-07-16T16:02:02Z")

</div>

Use the Loadvars object. =)  
[AS]myLoadVars = new LoadVars();  
myLoadVars.onLoad = function(success) {  
if (success) {  
// file loaded correctly  
// some actions here  
} else {  
// error loading file  
// some actions there  
}  
};  
myLoadVars.load(“myFile”);[/AS]  
[http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary427.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary427.html)
