title: AS3 mp3 Object in an array and retrieving and playing them help please New to AS3
body: <p>Hi there i am new to as3 and i am not sure i am writing it properly.</p>
  
  <p>i have a 10 sound variables that are linked to the mp3.
  i also have an songArray.
  and i have 10 buttons that are pushing the mp3 into the array
  and the play button just tracing the songArray but i don't know how to continue and to be able to play the mp3 in the same sequence that they entered into the array.</p>
  
  <pre><code>package {
  
  import C1.mp3;
  import C2.mp3;
  import C3.mp3;
  import C4.mp3;
  import C5.mp3;
  import C6.mp3;
  import C7.mp3;
  import C8.mp3;
  import C9.mp3;
  import C10.mp3;
  
  import flash.display.Sprite;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.events.MouseEvent;
  import flash.media.Sound;
  
  
  public class Main extends Sprite {
  
  
  
      private var master:Master = new Master();
  
      private var sound2:Sound = new C2.mp3();
      private var sound3:Sound = new C3.mp3();
      private var sound4:Sound = new C4.mp3();
      private var sound5:Sound = new C5.mp3();
      private var sound6:Sound = new C6.mp3();
      private var sound7:Sound = new C7.mp3();
      private var sound8:Sound = new C8.mp3();
      private var sound9:Sound = new C9.mp3();
      private var sound10:Sound = new C10.mp3();
  
      private var soundArray:Array = [];
  
      public function Main() {
  
          stage.scaleMode = StageScaleMode.NO_SCALE;
          stage.align = StageAlign.TOP_LEFT;
          init();
  
      }
  
      private function init():void {
          addChild(master);
  
          master.btn1.btnText.text = "A";
          master.btn2.btnText.text = "2";
          master.btn3.btnText.text = "3";
          master.btn4.btnText.text = "4";
          master.btn5.btnText.text = "5";
          master.btn6.btnText.text = "6";
          master.btn7.btnText.text = "7";
          master.btn8.btnText.text = "8";
          master.btn9.btnText.text = "9";
          master.btn10.btnText.text = "10";
  
          master.btn1.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn2.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn3.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn4.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn5.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn6.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn7.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn8.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn9.addEventListener(MouseEvent.CLICK, btnClicked);
          master.btn10.addEventListener(MouseEvent.CLICK, btnClicked);
  
          master.clearBtn.addEventListener(MouseEvent.CLICK, btnClicked);
          master.playBtn.addEventListener(MouseEvent.CLICK, btnClicked);
  
      }
  
      private function btnClicked(event:MouseEvent):void {
  
          switch (event.currentTarget.name){
  
              case "btn1":
                  trace("1");
                      //sound1.play();
                      soundArray.push(sound1);
                  break;
  
              case "btn2":
                  trace("2");
                      //sound2.play();
                      soundArray.push(sound2);
                  break;
  
              case "btn3":
                  trace("3");
                      soundArray.push(sound3);
                  break;
  
              case "btn4":
                  trace("4");
                      soundArray.push(sound4);
                  break;
  
              case "btn5":
                  trace("5");
                      soundArray.push(sound5);
                  break;
  
              case "btn6":
                  trace("6");
                      soundArray.push(sound6);
                  break;
  
              case "btn7":
                  trace("7");
                      soundArray.push(sound7);
                  break;
  
              case "btn8":
                  trace("8");
                      soundArray.push(sound8);
                  break;
  
              case "btn9":
                  trace("9");
                      soundArray.push(sound9);
                  break;
  
              case "btn10":
                  trace("10");
                      soundArray.push(sound10);
                  break;
  
          }
  
      }
  
      private function clearHandler():void {
          // Clean the soundArray back to empty.
          soundArray.splice(0);
  
      }
  
      private function playHandler():void{
  
          trace(soundArray);
      }
  
  
  
  }
  }
  </code></pre>