Les dejo el codigo, ojala alguien me pueda dar una mano.
package com.asgamer.basics1
{
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.Event;
import flash.events.MouseEvent;
public class Engine extends MovieClip
{
private var estrellas:int = 80;
public static var Lista:Array = new Array();
private var personaje:Ship;
public function Engine() : void
{
personaje = new Ship(stage);
stage.addChild(personaje);
personaje.x = stage.stageWidth / 2;
personaje.y = stage.stageHeight / 2;
for (var i:int = 0; i < estrellas; i++)
{
stage.addChildAt(new Star(stage), stage.getChildIndex(personaje));
}
addEventListener(Event.ENTER_FRAME, repite);
}
private function repite(e:Event) : void
{
if (Math.floor(Math.random() * 90) == 1)
{
var enemy:Blocker = new Blocker(stage, personaje);
var enemy2:Stinger = new Stinger(stage, personaje);
enemy.addEventListener(Event.REMOVED_FROM_STAGE, borrar);
enemy2.addEventListener(Event.REMOVED_FROM_STAGE, borrar);
Lista.push(enemy);
Lista.push(enemy2);
stage.addChild(enemy);
stage.addChild(enemy2);
}
}
private function borrar(e:Event)
{
Lista.splice(Lista.indexOf(e.currentTarget), 1);
}
}
}
Muchas Gracias.