AS3 Problem: Display Object

canArray is composed of 5 holes
slipperArray is composed of how many slippers i’ll throw…

each added movieclip of slippers are pushed in an array of SlipperArray…
oh and btw… it is slipper weapon used because it will be the default weapon…
i tried splicing…but error removing the movie clips

slipper do have a class.

i hitTestObject slipperArray to canArray… the scoring is done… done but not correct…
problems are:

  1. scoring…scores keep running up cause the display objects are not yet removed so it keeps hittesting the object.
    2.removing of slippers and cans

i have tried as all the forums says… please help…if problem 2 is solve…i can go on with my project… the adding of slippers to stage is okay… the removing after hitting a can is not okay…

stop();
//imports
import flash.sensors.Accelerometer;
import flash.events.AccelerometerEvent;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.utils.Timer;
import flash.events.TimerEvent;


//variables
var canArray:Array = new Array(hole0,hole1,hole2,hole3,hole4);
var monkeyArray:Array = new Array();
var SlipperArray:Array = new Array();
var HeelsArray:Array = new Array();
var ShoesArray:Array = new Array();
var BakyaArray:Array = new Array();
var BootsArray:Array = new Array();


//for Slippers
function SlipperLoop(event:Event):void
{
    hand.addEventListener(AccelerometerEvent.UPDATE, controlPlayer);
    stage.addEventListener(MouseEvent.CLICK, fireSlipper);
    stage.addEventListener(Event.ENTER_FRAME, slipperHitCan);
    checkSlippersOffScreen();
    checkEnemiesOffTheScreen();
    
}

function checkSlippersOffScreen():void
    {
        for(var r:int = 0; r < SlipperArray.length; r++)
        {
            var currentSlipper:weaponSlipper = SlipperArray[r];
            if(currentSlipper.y < 98)
            {
                SlipperArray.splice(r, 1);
                currentSlipper.destroySlipper();
            }
        }
    }

function fireSlipper(event:MouseEvent):void
    {
        trace("fireSlip");
        fireSlip();
    }

function fireSlip():void
    {
        trace("newSlip");
        var newSlipper:weaponSlipper = new weaponSlipper();
        stage.addChild(newSlipper);
        newSlipper.x = player.x;
        newSlipper.y = player.y - 40;
        SlipperArray.push(newSlipper);
        tries1(1);
        trace(SlipperArray.length);
    }

function slipperHitCan(event:Event):void{
    for(var k:int= 0; k < canArray.length; k++){
        for(var l:int= 0; l < SlipperArray.length; l++){
            if(SlipperArray[l].y > player.y) continue;
    if(SlipperArray[l].hitTestObject(canArray[k].canTimer.can.tipCan)){
                canArray[k].canTimer.gotoAndPlay(53);
                //getEnd(canArray[k], k);
                updateScore(100);
                //goalDaw();
                stage.removeChild(SlipperArray[l]);
                
                
                
            
            }
        }
        
    }
    
}

//control player
function controlPlayer(e:AccelerometerEvent):void
    {
        player.x -= (e.accelerationX*100);
        putPlayerOnTheStage();
        
    }
function putPlayerOnTheStage():void
    {
        if(player.x < (player.width/2))
        {
            player.x = player.width/2;
        }
        else if(player.x > stage.stageWidth)
        {
            player.x = stage.stageWidth + 10;
        }
    }

//check enemies off the screen
function checkEnemiesOffTheScreen():void
    {
            for(var u:int = 0; u < monkeyArray.length; u++)
            {
                var currentMonkey:enemy = monkeyArray[u];
                if(currentMonkey.mDirection == "L" && currentMonkey.x < -(currentMonkey.width / 2))
                    {
                        monkeyArray.splice(u, 1);
                        currentMonkey.destroyMonkey();
                    }else
                    if(currentMonkey.mDirection == "R" && currentMonkey.x > (stage.stageWidth + currentMonkey.width / 2))
                        {
                            monkeyArray.splice(u, 1);
                            currentMonkey.destroyMonkey();
                        }
            }
    }