[as2] Setting Intervals based on attachMovie

Hello again,

In another post, I’ve been able to work with a setInterval problem to a setTimeout solution.
Unfortunately, I’ve run into another problem:
Instead of allowing the setTimeout to trigger as soon as any object is placed on the stage, the setTimeout seems to only work the instance for one of the object.

The current code is as follows:


createObj(1, random(440)+40, "enemy1", "ship1"); 

function createObj(locy:Number, locx:Number, char_name:String, char_visual:String):Void{

    var mc = _root.attachMovie(char_visual, char_name, _root.getNextHighestDepth());

    // code ommitted
    
    if (mc.typ == "ship1"){
        shoot0 = setTimeout(fireHero, 800, mc.nam);
        shoot1 = setTimeout(fireHero, 1200, mc.nam);
        mc.onEnterFrame = function()
        {
            // code ommitted
        }
    }
}

I think the setTimeout expires the interval trigger after the first object has entered into the scene thus, nullifying all the other objects in the future.

If I can be helped to a solution that will allow me to trigger those events exclusively from all other objects, that would be great.

kpxnamja