# SharedObject and Arrays

**URL:** https://forum.kirupa.com/t/sharedobject-and-arrays/25989
**Category:** flash
**Created:** [July 18, 2003, 10:17am UTC](https://forum.kirupa.com/t/sharedobject-and-arrays/25989 "2003-07-18T10:17:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bsprathapsimha](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bsprathapsimha](https://forum.kirupa.com/u/bsprathapsimha)
#### Post date: [July 18, 2003, 10:17am UTC](https://forum.kirupa.com/t/sharedobject-and-arrays/25989/1 "2003-07-18T10:17:16Z")

</div>

hi,

can anyone tell me how to save data into array using sharedobject.

For example:

There is one text field on the stage. Think that it is meant for user to enter UserName.

So I want to store the usernames in an array. When a user types the user name which already exists, its shoudl display a message saying that “user name already exists”.

I thik this can be done by saving into arrays. Can you tell me how to put these usernames into array and retrive data using shared objects. How to check whether it already exists.

Thanking you\<  
Prathap

---

<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 18, 2003, 1:42pm UTC](https://forum.kirupa.com/t/sharedobject-and-arrays/25989/2 "2003-07-18T13:42:53Z")

</div>

First of all, you would have to use a button or something, because the person would have to specify when they have completed entering their name.

So, within the button actions, you could do

[AS]  
on(release, press) {

for (i = 0; i \< nameArray.length; i++){  
if (theVariableNameForTheTextField == nameArray\*){  
nameFoundBoolean = true;  
}  
}

if (!nameFoundBoolean){  
nameArray.push(theVariableNameForTheTextField);  
}else{  
trace(“The user name already exists”);  
}  
}

[/AS]

Hope that helps a bit.

---

<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 19, 2003, 7:24am UTC](https://forum.kirupa.com/t/sharedobject-and-arrays/25989/3 "2003-07-19T07:24:25Z")

</div>

hi,

thank you,

I will get back to you after working on that,

thank you very much,

let me see if it works fine,

thanking you,  
prathap
