# AS3 Going backwards in an Array of MovieClips for an image gallery

**URL:** <https://forum.kirupa.com/t/as3-going-backwards-in-an-array-of-movieclips-for-an-image-gallery/319540>\
**Category:** flash\
**Created:** [February 24, 2011, 5:02am UTC](https://forum.kirupa.com/t/as3-going-backwards-in-an-array-of-movieclips-for-an-image-gallery/319540 "2011-02-24T05:02:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SammyTheBear](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SammyTheBear](https://forum.kirupa.com/u/SammyTheBear)\
**Post date:** [February 24, 2011, 5:02am UTC](https://forum.kirupa.com/t/as3-going-backwards-in-an-array-of-movieclips-for-an-image-gallery/319540/1 "2011-02-24T05:02:36Z")

</div>

I am trying to make a back button work for an image gallery with MovieClips in an array. I want to go backwards in the image gallery and am coming up with this error:

TypeError: Error #2007: Parameter child must be non-null.  
at flash.display::DisplayObjectContainer/removeChild()  
at DigitalSignage\_Gallery\_fla::MainTimeline/lastPick()

Here is the code:

var Fullsize\_Pic:Array = new Array();

Fullsize\_Pic[0] = new Fullsize\_01();  
Fullsize\_Pic[1] = new Fullsize\_02();  
Fullsize\_Pic[2] = new Fullsize\_03();

//Defines first image  
var aPic = 0;

addChild(Fullsize\_Pic[aPic]);

//Event Listeners for buttons  
Controls.Button1.addEventListener(MouseEvent.CLICK, lastPick);  
[//Controls.Button2.addEventListener](https://Controls.Button2.addEventListener)(MouseEvent.CLICK, nextPick);

//Changing fullsize images  
function lastPick(event:MouseEvent):void  
{  
if (aPic == 0)  
{  
var bPic = 34;

```
removeChild(Fullsize_Pic[aPic]);
addChild(Fullsize_Pic[bPic]);

var aPic = bPic;
}
else {

var bPic = aPic - 1;

removeChild(Fullsize_Pic[aPic]);
addChild(Fullsize_Pic[bPic]);

var aPic = bPic;
}

```

}

Cheers! And thanks for the help in advance 🙂
