# Array problem?

**URL:** <https://forum.kirupa.com/t/array-problem/277619>\
**Category:** flash\
**Created:** [December 15, 2008, 12:25am UTC](https://forum.kirupa.com/t/array-problem/277619 "2008-12-15T00:25:21Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [December 15, 2008, 12:25am UTC](https://forum.kirupa.com/t/array-problem/277619/1 "2008-12-15T00:25:21Z")

</div>

Hello!

Been a while since I’ve been here…tee hee. :hugegrin: Anyway, I’ve been working on a project…that will report to me the files in a folder in my hard drive. I’m sending the results of my array (of the files in the folder) to a string in a this manner:

```auto

//This is actually a dynamically generated variable and not a static one.
var files:Array = ['blah.jpg','blah.jpg','blah.jpg','image.jpg'];
//Declaring the string to store array in...
var filesString:String;
for(var i:Number = 0; i<files.length; i++){
     filesString = fileString+" "+files*;
}

```

I’m needing to find the file called “image.jpg” and position it a the beginning of the string, like this:

```auto
image.jpg blah.jpg blah.jpg blah.jpg

```

However, each time I run the for loop, “image.jpg” might be in a different place. Is there a way to put image.jpg a the beginning no matter what?

Any help or comment is greatly appreciated!

Thanks!
