# Help Cleaning this code

**URL:** <https://forum.kirupa.com/t/help-cleaning-this-code/269669>\
**Category:** flash\
**Created:** [August 30, 2008, 12:52pm UTC](https://forum.kirupa.com/t/help-cleaning-this-code/269669 "2008-08-30T12:52:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodlab2x](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rodlab2x](https://forum.kirupa.com/u/rodlab2x)\
**Post date:** [August 30, 2008, 12:52pm UTC](https://forum.kirupa.com/t/help-cleaning-this-code/269669/1 "2008-08-30T12:52:47Z")

</div>

I’m relatively new to AS3 and learning. I would like to know how to reduce this code by maybe using arrays or loops? and still work the same. I’m using Tweener here. I pasted 2 of 6 buttons actions and if I wanted to make 6 or more buttons seems like alot of code?

import caurina.transitions.\*;

but1.addEventListener(MouseEvent.ROLL\_OVER, PopIn1);  
but1.addEventListener(MouseEvent.ROLL\_OUT, PopOut1);

function PopIn1(e:MouseEvent):void {  
Tweener.addTween(glow1, {alpha:1,time:1,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(arrow1, {alpha:1,time:0.5,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(text1, {alpha:1,time:0.5,delay:0.8, transition:“easeInOutSine”});  
Tweener.addTween(step1, {scaleX:1, scaleY:1,delay:0.61,time:0.5,transition:“easeInOutSine”});  
Tweener.addTween(logo, {alpha:0,time:0.5,delay:0.5, transition:“easeInOutSine”});  
Tweener.addTween(nitrologo, {alpha:1,time:0.5,delay:0.7, transition:“easeInOutSine”});  
lines.sublines.play()  
step1.lines.sublines.play()  
arrow1.gotoAndPlay(2);  
}

function PopOut1(e:MouseEvent):void {  
Tweener.addTween(step1, {scaleX:0, scaleY:0,time:0.5,transition:“easeInOutSine”});  
Tweener.addTween(logo, {alpha:1,time:0.5,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(glow1, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(arrow1, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(text1, {alpha:0,time:0.5,delay:0.3, transition:“easeInOutSine”});  
Tweener.addTween(nitrologo, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
lines.sublines.stop()  
step1.lines.sublines.stop()  
}

but2.addEventListener(MouseEvent.ROLL\_OVER, PopIn2);  
but2.addEventListener(MouseEvent.ROLL\_OUT, PopOut2);

function PopIn2(e:MouseEvent):void {  
Tweener.addTween(text2, {alpha:1,time:0.5,delay:0.8, transition:“easeInOutSine”});  
Tweener.addTween(glow2, {alpha:1,time:1,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(arrow2, {alpha:1,time:0.5,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(step2, {scaleX:1, scaleY:1,delay:0.5,time:0.5,transition:“easeInOutSine”});  
Tweener.addTween(logo, {alpha:0,time:0.5,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(nitrologo, {alpha:1,time:0.5,delay:0.65, transition:“easeInOutSine”});  
arrow2.gotoAndPlay(2);  
}

function PopOut2(e:MouseEvent):void {  
Tweener.addTween(step2, {scaleX:0, scaleY:0,time:0.5,transition:“easeInOutSine”});  
Tweener.addTween(logo, {alpha:1,time:1,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(glow2, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(arrow2, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
Tweener.addTween(text2, {alpha:0,time:0.5,delay:0.3, transition:“easeInOutSine”});  
Tweener.addTween(nitrologo, {alpha:0,time:0.3,delay:0, transition:“easeInOutSine”});  
}
