This is what I changed and it seems to work well enough, but if anyone has a better way of doing what I want to do let me know.
And what's wrong with the child index?Code:var glideShootingTimer:Timer = new Timer (500); glideShootingTimer.start(); // place this in if statement for faster run time (Start/Stop when needed) glideShootingTimer.addEventListener(TimerEvent.TIMER, glideShoot); function glideShoot(evt:Event) { glideShootingTimer.delay = (500/glideArray.length); var g:int = int(Math.random() * glideArray.length-1); if (glideArray[g]._shoot == true) { //create new instance of torpedo var newTorpedo = new EnemyTorpedo(); //set the torpedo's X and Y properties newTorpedo.x = glideArray[g].x; newTorpedo.y = glideArray[g].y; //set the rotation, and give it a property, so we can animate it correctly newTorpedo.rotation = newTorpedo._rot = glideArray[g].rotation; //stuff it into the array torpedoArray.push(newTorpedo); //put it on the stage addChild(newTorpedo); //put it on index just under glide that shot it setChildIndex(newTorpedo, getChildIndex(glideArray[g]) - 1); } }




Reply With Quote
