Wednesday, June 27, 2012

[Action Script] playing sounds from array names. June,2012

Hi, I have the following array:

Code: var sonidos:Array = ["do4", "sol4"];
how can I pass the proper names to play every sound in a function?

Currently I have:
Code: function PlayAllSam(arr:Array){
                var sizeArray = arr.length;
                trace (sizeArray+" elements.");

        for (var index in arr) {
                trace(index+" => "+arr[index]);
                arr[index].play(0,1);
        }
        }it works fine if in function I only write

Code: do4.play(0,1);How can I do this?

TIA.
playing sounds from array names.

Related Post



0 comments: