So I’m trying to create a virtual piano using Adobe Flash CS3.
I have a library graphic called “whitekey” and a library graphic called “key”.
I also have library sounds corresponding the strings in the array.
The code in bold does not work as it gives me an “Expecting identifier before this” error. How would I fix this?
var keys: Array = [“c”,“csharp”,“d”,“dsharp”,“e”,“f”,“fsharp”,“g”,“gsharp”,“a”,“asharp”,“b”,“c2”];
for (var i:int = 0; i < keys.length; i++) {
this["play" + keys* + "sound"] = function (event:MouseEvent):void {
** var this[keys* + “sound”]= new keys*;
this[keys* + “sound”].play(550);}
**
this[“key_” + keys*].addEventListener(MouseEvent.ROLL_OVER, (this[“play” + keys* + “sound”]));
this[“key_” + keys*].addEventListener(MouseEvent.CLICK, (this[“play” + keys* + “sound”]));