# Variable characters, one action set?

**URL:** <https://forum.kirupa.com/t/variable-characters-one-action-set/234369>\
**Category:** Uncategorized\
**Created:** [August 1, 2007, 6:22pm UTC](https://forum.kirupa.com/t/variable-characters-one-action-set/234369 "2007-08-01T18:22:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [August 1, 2007, 6:22pm UTC](https://forum.kirupa.com/t/variable-characters-one-action-set/234369/1 "2007-08-01T18:22:47Z")

</div>

im making a game that uses 4 different characters, and uses this script to place the caracter of choice

//emilia is on of 4 char statements (jason, emilia, sam, and oogle)  
player.addChild(new emilia());  
player.x = 200;  
player.y = 490;

the problem is that all the event scripting refers to player, because the player character can be variable, but the actions for each character are the same. when i did a trace it stated that player is an object and emilia was a class. is there any way to get all the different players to be “player”, in other words, react to anything that player is told to do.

here is a little sinpet of the actions code for an example

//this works fine just need to to be variable to player  
function output(event:KeyboardEvent) {  
switch (event.keyCode) {  
case 37 :  
player.x -= 5;  
player.gotoAndStop(“left”)  
break;

```
    case 39 :
        player.x += 5;

```

player.gotoAndStop(“right”)  
break;  
}  
}

the gotoAndStop has no effect at all

please help… :hr:
