# Tidying up my coding

**URL:** <https://forum.kirupa.com/t/tidying-up-my-coding/253606>\
**Category:** Uncategorized\
**Created:** [March 3, 2008, 1:57pm UTC](https://forum.kirupa.com/t/tidying-up-my-coding/253606 "2008-03-03T13:57:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hoolagon](https://avatars.discourse-cdn.com/v4/letter/h/58956e/32.png) [@hoolagon](https://forum.kirupa.com/u/hoolagon)\
**Post date:** [March 3, 2008, 1:57pm UTC](https://forum.kirupa.com/t/tidying-up-my-coding/253606/1 "2008-03-03T13:57:29Z")

</div>

Hi,

I am still learning AS3 and am aware my code is too long, but not sure how to compress it. What syntax do I need to use in order to get this kind of thing into a loop?

Thanks,

J

```php

function link1_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link1, {time:.5, _color:0xffffff})
}
function link2_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link2, {time:.5, _color:0xffffff})
}
function link3_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link3, {time:.5, _color:0xffffff})
}
function link4_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link4, {time:.5, _color:0xffffff})
}
function link5_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link5, {time:.5, _color:0xffffff})
}
function link6_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link6, {time:.5, _color:0xffffff})
}
function link7_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link7, {time:.5, _color:0xffffff})
}
function link8_ROLLOVER_fn(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link8, {time:.5, _color:0xffffff})
}
function link1_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link1, {time:1, _color:linkColor})
}
function link2_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link2, {time:1, _color:linkColor})
}
function link3_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link3, {time:1, _color:linkColor})
}
function link4_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link4, {time:1, _color:linkColor})
}
function link5_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link5, {time:1, _color:linkColor})
}
function link6_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link6, {time:1, _color:linkColor})
}
function link7_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link7, {time:1, _color:linkColor})
}
function link8_RollOut(event:MouseEvent):void
{
    Tweener.addTween(nav_mc.link8, {time:1, _color:linkColor})
}

```
