Created
January 23, 2018 04:29
-
-
Save sunho/d99a1ace3cd590da64930163133659cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var colors:Array = ["red","blue","green"]; | |
var buttons:Array = new Array(); | |
function colorSwitch(frame:Number) { | |
return function(e:MouseEvent) { | |
color.gotoAndStop(frame); | |
} | |
} | |
for (var i=0;i<colors.length;i++) { | |
buttons[i]=new button; | |
buttons[i].y=30*i; | |
buttons[i].colorName.text = colors[i]; | |
buttons[i].addEventListener(MouseEvent.CLICK,colorSwitch(i+1)); | |
addChild(buttons[i]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment