flex - Trying to generate Buttons with a loop, but Icon property causes problem -


I am trying to generate a button with the loop of an array, but I have the icon style and Stylename work: ( (Var x: int = 0; x & lt; smileys.length; x ++) {var emoticon: button = new button (); var label: string = smileys [/ p>

 X] [0]; emoticon.width = 24; emoticon.height = 24; emoticon.x = position x; emoticon.i = 0; emoticon.txtname ('button emg'); // does not work ... emoticon setStyle ("Icon", "@mp3ed (source = 'smileys'' + smileys [X] [0] + ". Png ')" emoticons group.edbuild (emoticon); conditionx + = 24;}   

I also tried to include it in the loop but It does not work:

  [embed (source = "smileys" / smileys [x] [0] + ".png")] // fb does not like that var button Icon: Class; emoticon.setStyle ("icon", button icon);    

You can not insert variables into an embedding because it is an instruction for the compiler, a runtime rizo L. No n. Now, you can either create as many variables as smiley and then have N-static embedding

  • for a button, its own Create skin, which accept image or loader and load images instantly inside the button
  • An SDF preload with all your images And use the emoticon.setStyle ("icon", getDefinitionByName (smileys [x] [0])) where smileys [x] [0] Flash Pu Smiley's link name is in the school.

  • Comments