kwontae Posted January 15, 2013 Share Posted January 15, 2013 I need some help. I'm new to ActionScript and my code looks too long. If I make more button and checkbox, it would be much longer. I'm sure there is some way to make it shorter. So if anyone can help me, it would be much appreciated. Here is my code. var checks:Array = [check01,check02,check03,check04,check05,check06,check07,check08,check09,check10,check11,check12,check13,check14,check15,check16,check17,check18,check19]; var btnENums:Array = ["btnE01","btnE02","btnE03","btnE04","btnE05","btnE06","btnE07","btnE08","btnE09","btnE10","btnE11","btnE12","btnE13","btnE14","btnE15","btnE16","btnE17","btnE18","btnE19"]; addEventListener(Event.ENTER_FRAME, checkBoxHandler_1); function checkBoxHandler_1(event:Event):void { if (btnspeak.currentLabel == "btnE02" && check02.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE03" && check03.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE04" && check04.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE05" && check05.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE06" && check06.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE07" && check07.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE08" && check08.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE09" && check09.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE10" && check10.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE11" && check11.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE12" && check12.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE13" && check13.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE14" && check14.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE15" && check15.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE16" && check16.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE17" && check17.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE18" && check18.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE19" && check19.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } if (btnspeak.currentLabel == "btnS01-1") { removeEventListener(Event.ENTER_FRAME, checkBoxHandler_1); } } Link to comment Share on other sites More sharing options...
Carl Posted January 15, 2013 Share Posted January 15, 2013 Hi Kwontae, It would be more appropriate and effective to post this in a forum dedicated to general ActionScript issues. http://forums.adobe.com/community/flash/flash_actionscript3 http://www.actionscript.org/forums/forumdisplay.php3?f=75 I'm sure folks in those forums will be eager to jump on something like this. We really have to focus our efforts on the GreenSock Animation Platform. Thanks for understanding. Link to comment Share on other sites More sharing options...
kwontae Posted January 17, 2013 Author Share Posted January 17, 2013 No problem. Thank for your reply. Next time, I will post only regarding of the GreenSock Animation. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now