i have code below
What i want to know is how to simplify above code like belowCode:btn_home.addEventListener(MouseEvent.CLICK, goto_home); btn_contact.addEventListener(MouseEvent.CLICK, goto_contact); btn_about.addEventListener(MouseEvent.CLICK, goto_about); function goto_home(event:MouseEvent):void{ this.gotoAndStop(2); } function goto_contact(event:MouseEvent):void{ this.gotoAndStop(3); } function goto_about(event:MouseEvent):void{ this.gotoAndStop(4); }
UNFORTUNATELY that code doesn't work anymore.Code:var myframe:int; btn_home.addEventListener(MouseEvent.CLICK, gotoframe(2)); btn_contact.addEventListener(MouseEvent.CLICK, gotoframe(3)); btn_about.addEventListener(MouseEvent.CLICK, gotoframe(4)); function gotoframe(myframe):void{ this.object_okie.gotoAndStop(myframe); }
can somebody help me?
IT WILL BE SO HARD FOR ME IF I MAKE 10 buttons, thanks



Reply With Quote
Bookmarks