Flash Action Script 3 - If else statements help

shammaxxy

Well-known member
  • May 21, 2011
    1,330
    346
    83
    දන්න කෙනෙක් ඉන්නවනම් මම මේ පහල දාල තියෙන code එක කෙටි කරලා දෙනවද?

    Code:
    review_btn.addEventListener(MouseEvent.CLICK, review1)
    function review1(event:MouseEvent):void{
    
    if(rvw1 == "Correct"){ 
    	gotoAndStop(3627);
    	help1.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	help1.visible = true
    
    }
    }
    
    review_btn.addEventListener(MouseEvent.CLICK, review2)
    function review2(event:MouseEvent):void{
    
    if(rvw2 == "Correct"){ 
    	gotoAndStop(3627);
    	help2.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	help2.visible = true
    
    }
    }
    
    review_btn.addEventListener(MouseEvent.CLICK, review3)
    function review3(event:MouseEvent):void{
    
    if(rvw3 == "Correct"){ 
    	gotoAndStop(3627);
    	help3.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	help3.visible = true
    
    }
    }
    
    review_btn.addEventListener(MouseEvent.CLICK, review4)
    function review4(event:MouseEvent):void{
    
    if(rvw4 == "Correct"){ 
    	gotoAndStop(3627);
    	help4.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	help4.visible = true
    
    }
    }
    
    review_btn.addEventListener(MouseEvent.CLICK, review5)
    function review5(event:MouseEvent):void{
    
    if(rvw5 == "Correct"){ 
    	gotoAndStop(3627);
    	help5.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	help5.visible = true
    
    }
    }

    මෙන්න මේ වගේ තනි function එහෙකට ගන්න පුලුවන්නම් තමා හොඳ... දන්නේ නැති අය පුලුවන්නම් bump එකක්වත් දාගෙන යන්න....

    Code:
    review_btn.addEventListener(MouseEvent.CLICK, review)
    function review(event:MouseEvent):void{
    
    if(rvwX == "Correct"){ 
    	gotoAndStop(3627);
    	helpX.visible = false
    	
    	}
    else{ 
    	gotoAndStop(3627);
    	helpX.visible = true
    
    }
    }



    බොහොම ස්තුතියි!
     
    Last edited: