# About arrays. NEED HELP!

**URL:** <https://forum.kirupa.com/t/about-arrays-need-help/63265>\
**Category:** flash\
**Created:** [September 4, 2004, 4:24pm UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265 "2004-09-04T16:24:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![murka390](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@murka390](https://forum.kirupa.com/u/murka390)\
**Post date:** [September 4, 2004, 4:24pm UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/1 "2004-09-04T16:24:16Z")

</div>

i need that to have an array with 166 numbers. ("\_parent.\_parent.totalFrames = 167" and “q != \_parent.\_parent.currentframe” ) is the following code correct?

myArray = [];  
for (var q = 1; q != \_parent.\_parent.\_currentframe && q\<168; q++) {  
myArray.push(q);

---

<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:** [September 4, 2004, 6:30pm UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/2 "2004-09-04T18:30:11Z")

</div>

> [@murka390](#):
>
> i need that to have an array with 166 numbers. (“\_parent.\_parent.totalFrames = 167” and “q != \_parent.\_parent.currentframe” ) is the following code correct?
> 
> myArray = ;  
> for (var q = 1; q != \_parent.\_parent.\_currentframe && q\<168; q++) {  
> myArray.push(q);

maybe  
myArray = ;  
for (var q = 1; q\<168; q++) {  
myArray.push(q);  
}  
myvar = this.\_parent.\_parent.\_currentframe;  
myArray.splice(myvar, 1);

not sure how functional this is

---

<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:** [September 5, 2004, 7:32am UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/3 "2004-09-05T07:32:35Z")

</div>

i figured it out, and it works 🙂

```
var my = [];
var i = 1;
while (i&lt;168) {
	my.push(i++);
}
var current = _root._currentframe
my.splice(current-1,1)
trace(my.join());
trace(_root._currentframe);

```

thnx to stringy!

---

<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:** [September 5, 2004, 9:12am UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/4 "2004-09-05T09:12:21Z")

</div>

now… this wery confusing problem has come while expanding that script…  
while the first part works (when \_root.\_currentframe\<168, it removes \_root.\_currentframe from the array), but the second part does not work (when \_root.\_currentframe\>167, it does not remove \_roor.\_currentframe)  
whats wrong with it???

this.onEnterFrame = function() {  
var current = \_root.\_currentframe-1;  
if (\_root.\_currentframe\<168) {  
var my = [];  
var i = 1;  
while (i\<168) {  
my.push(i++);  
}  
my.splice(current, 1);  
trace(my.join());  
trace(\_root.\_currentframe);  
} [COLOR=DarkRed]else if (\_root.\_currentframe\>167) {  
var my = [];  
var i = 168;  
while (i\<248) {  
my.push(i++);  
}  
my.splice(current, 1);  
trace(my.join());  
trace(\_root.\_currentframe);  
}[/COLOR]  
};

---

<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:** [September 5, 2004, 9:42am UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/5 "2004-09-05T09:42:05Z")

</div>

> [@murka390](#):
>
> now… this wery confusing problem has come while expanding that script…  
> while the first part works (when \_root.\_currentframe\<168, it removes \_root.\_currentframe from the array), but the second part does not work (when \_root.\_currentframe\>167, it does not remove \_roor.\_currentframe)  
> whats wrong with it???
> 
> this.onEnterFrame = function() {  
> var current = \_root.\_currentframe-1;  
> if (\_root.\_currentframe\<168) {  
> var my = ;  
> var i = 1;  
> while (i\<168) {  
> my.push(i++);  
> }  
> my.splice(current, 1);  
> trace(my.join());  
> trace(\_root.\_currentframe);  
> } [COLOR=DarkRed]else if (\_root.\_currentframe\>167) {  
> var my = ;  
> var i = 168;  
> while (i\<248) {  
> my.push(i++);  
> }  
> my.splice(current, 1);  
> trace(my.join());  
> trace(\_root.\_currentframe);  
> }[/COLOR]  
> };

you need to use my.splice(current-167, 1);  
took me a while to work out, deleting variables etc to start with

---

<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:** [September 5, 2004, 10:00am UTC](https://forum.kirupa.com/t/about-arrays-need-help/63265/6 "2004-09-05T10:00:20Z")

</div>

oh, right… doh  
because the array has only 80 numbers in it ( in the second case )

THNX 😃
