mon code
Pour les variables dupliquer, j'ai corrigé.
import flash.events.Event;
import flash.geom.ColorTransform;
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
function keyDownHandler(e:KeyboardEvent)
{
if(e.keyCode == 81){
{
var mySound1:Sound = new sonDo();
mySound1.play();
var coul:ColorTransform= new ColorTransform();
coul.color=0x00FF00;
bt1.transform.colorTransform=coul;
}
}
if(e.keyCode == 83){
{
var mySound2:Sound = new sonRe();
mySound2.play();
var coul1:ColorTransform= new ColorTransform();
coul1.color=0x00FF00;
bt2.transform.colorTransform=coul1;
}
}
if(e.keyCode == 68){
{
var mySound3:Sound = new sonMi();
mySound3.play();
var coul2:ColorTransform= new ColorTransform();
coul2.color=0x00FF00;
bt3.transform.colorTransform=coul2;
}
}
if(e.keyCode == 70){
{
var mySound4:Sound = new sonFa();
mySound4.play();
var coul3:ColorTransform= new ColorTransform();
coul3.color=0x00FF00;
bt4.transform.colorTransform=coul3;
}
}
if(e.keyCode == 71){
{
var mySound5:Sound = new sonSol();
mySound5.play();
var coul4:ColorTransform= new ColorTransform();
coul4.color=0x00FF00;
bt5.transform.colorTransform=coul4;
}
}
if(e.keyCode == 72){
{
var mySound6:Sound = new sonLa();
mySound6.play();
var coul5:ColorTransform= new ColorTransform();
coul5.color=0x00FF00;
bt6.transform.colorTransform=coul5;
}
}
if(e.keyCode == 74){
{
var mySound7:Sound = new sonSi();
mySound7.play();
var coul6:ColorTransform= new ColorTransform();
coul6.color=0x00FF00;
bt7.transform.colorTransform=coul6;
}
}
if(e.keyCode == 75){
{
var mySound8:Sound = new sonDoo();
mySound8.play();
var coul7:ColorTransform= new ColorTransform();
coul7.color=0x00FF00;
bt8.transform.colorTransform=coul7;
}
}
if(e.keyCode == 87){
{
var mySound9:Sound = new sonDooo();
mySound9.play();
var coul8:ColorTransform= new ColorTransform();
coul8.color=0x1B019B;
n1.transform.colorTransform=coul8;
}
}
if(e.keyCode == 88){
{
var mySound10:Sound = new sonRee();
mySound10.play();
var coul9:ColorTransform= new ColorTransform();
coul9.color=0x1B019B;
n2.transform.colorTransform=coul9;
}
}
if(e.keyCode == 67){
{
var mySound11:Sound = new sonFaa();
mySound11.play();
var coul10:ColorTransform= new ColorTransform();
coul10.color=0x1B019B;
n3.transform.colorTransform=coul10;
}
}
if(e.keyCode == 86){
{
var mySound12:Sound = new sonSoll();
mySound12.play();
var coul11:ColorTransform= new ColorTransform();
coul11.color=0x1B019B;
n4.transform.colorTransform=coul11;
}
}
if(e.keyCode == 66){
{
var mySound13:Sound = new sonLaa();
mySound13.play();
var coul12:ColorTransform= new ColorTransform();
coul12.color=0x1B019B;
n5.transform.colorTransform=coul12;
}
}
}
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler)
function keyUpHandler(e:KeyboardEvent):void{
if(e.keyCode == 81){
{
var coul:ColorTransform= new ColorTransform();
coul.color=0xFFFFFF;
bt1.transform.colorTransform=coul;
}
}
//relacher touches
if(e.keyCode == 83){
{
var coul1:ColorTransform= new ColorTransform();
coul1.color=0xFFFFFF;
bt2.transform.colorTransform=coul1;
}
}
if(e.keyCode == 68){
{
var coul2:ColorTransform= new ColorTransform();
coul2.color=0xFFFFFF;
bt3.transform.colorTransform=coul2;
}
}
if(e.keyCode == 70){
{
var coul3:ColorTransform= new ColorTransform();
coul3.color=0xFFFFFF;
bt4.transform.colorTransform=coul3;
}
}
if(e.keyCode == 71){
{
var coul4:ColorTransform= new ColorTransform();
coul4.color=0xFFFFFF;
bt5.transform.colorTransform=coul4;
}
}
if(e.keyCode == 72){
{
var coul5:ColorTransform= new ColorTransform();
coul5.color=0xFFFFFF;
bt6.transform.colorTransform=coul5;
}
}
if(e.keyCode == 74){
{
var coul6:ColorTransform= new ColorTransform();
coul6.color=0xFFFFFF;
bt7.transform.colorTransform=coul6;
}
}
if(e.keyCode == 75){
{
var coul7:ColorTransform= new ColorTransform();
coul7.color=0xFFFFFF;
bt8.transform.colorTransform=coul7;
}
}
if(e.keyCode == 87){
{
var coul8:ColorTransform= new ColorTransform();
coul8.color=0x000000;
n1.transform.colorTransform=coul8;
}
}
if(e.keyCode == 88){
{
var coul9:ColorTransform= new ColorTransform();
coul9.color=0x000000;
n2.transform.colorTransform=coul9;
}
}
if(e.keyCode == 67){
{
var coul10:ColorTransform= new ColorTransform();
coul10.color=0x000000;
n3.transform.colorTransform=coul10;
}
}
if(e.keyCode == 86){
{
var coul11:ColorTransform= new ColorTransform();
coul11.color=0x000000;
n4.transform.colorTransform=coul11;
}
}
if(e.keyCode == 66){
{
var coul12:ColorTransform= new ColorTransform();
coul12.color=0x000000;
n5.transform.colorTransform=coul12;
}
}
}