Movie Clip Object adding Multiple Times with Enter_Frame Event

51 Views Asked by At

Hey Guys so I am using TweenLite to act as a timer for Performance with Mobile usage. I ran into a little problem here that I can't seem to figure out. So In my ENTER_FRAME Listener I have this function difficultyController Where I add my TweenLite control like so:

    private function difficultyController():void 
    {
        if (nScore >= 10)
        {
            TweenLite.delayedCall(nChainsaw, addChainsaw);
            trace("DIFFICULTY_UPDATE");
        }
    }

In my addChainsaw Function I have the Movie Clip Objects added to the stage like so:

    private function addChainsaw():void 
    {
        TweenLite.delayedCall(nChainsaw, addChainsaw);
        var newChainsaw = new mcChainsaw();
        //Add Child
        addChild(newChainsaw);
        //Push Move CLips into array
        aChainsawArray.push(newChainsaw);
        trace(aChainsawArray.length + "chainsaw");
    }

Now I want the chainsaw Movie clip in the array to be added to the stage every 2 seconds which is what the value of nChainsaw is. Ill kill it off when the nScore reaches a higher number. But as of right now when I test the Game like so It adds Multiple Movie clips over and over again then freezes the game. I know it has to do with the ENTER_FRAME Listener But I don't know what else to do. SHould I just remove the TweenLite and add A Actual Timer and in the diffucultyController(); just add timer.start??

If anyone has anyother Ideas I would really Appreciate it thanks!

0

There are 0 best solutions below