2 Replies Latest reply on Mar 22, 2010 6:08 PM by smon_ed

    Concatenate a spark button skin name

    smon_ed Level 1

      Say, for example, I had two button skins:  button1skin and button2skin


      How could I reference one of those classes within a loop by concatenating?




      for (var i:int = 1; i<=2; i++){
           var btn:Button = new Button();
           btn.id= "button"+i+"_btn";
           btn.label = "selection "+i;     
           var mySkin:SparkSkin= ["button"+i+"skin"]
           btn.setStyle("skinClass", mySkin);


      It's a bit of an odd example, I know, but I'd like to know how to go about getting a reference to a skin this way, if it's possible.


      Thanks in advance for any help!!