hi there,

I got a class called NPC, which has a method called goToRoom:

PHP Code:
public function goToRoom(dest:String):Void {
        
trace(this.name " going to " dest);
        
this.room.unloadNPC(this);
        var 
rm:RoomManager RoomManager.getInstance();
        var 
rm.getRoom(dest);
        
this.mc r.loadNPC(this);
        
this.mc.setArgs(this.name);
    } 
the room attribute is a reference to an instance of the Room class. the unloadNPC method, clears the npc from the current room it is in atm. With the String dest I load the NPC in the Room with String dest. loadRoom is a method of the Room class, which is printed out below. setArgs is a method of a class called ClickableNPC. This class is a class that makes an instance of the graphical appearance of the NPC class.

PHP Code:
public function loadNPC(npc:NPC):MovieClip {
        var 
mc_ref:MovieClip;
        for (var 
i:Number 0this.ptNPC.lengthi++) {
            if (
this.ptNPC[i].npcSet == false) {
                
mc_ref this.ptNPC[i].attachMovie(npc.getMC(), "npc" ithis.ptNPC[i].getNextHighestDepth());
                
trace("loaded cnpc " npc.getName());
                var 
ref:Object = new Object();
                
ref.mc mc_ref;
                
ref.id npc.getID();
                
this.npcArray.push(ref);
                
this.ptNPC[i].npcSet true;
                
npc.setRoom(this);
                break;
            }
        }
        return 
mc_ref;
    } 
In this method I create a var called mc_ref. I attach a movieclip to this var. The linkage to the movieclip is a movieclip which is registered to the ClickableNPC class. So when I load an NPC its graphical appearence (ClickableNPC instance) is loaded to a point of the ptNPC array. Then I return the ClickableNPC. But here's the issue; the setArgs method, uses the parameter of the last created ClickableNPC to all other ClickableNPC's. other then that the classes work perfectly, all other events and methods of the ClickableNPC work properly. The args parameter is written to a non-static variable of the ClickableNPC class. Anybody has an explination for this strange behavior?