# Fill Function

**URL:** https://forum.kirupa.com/t/fill-function/220041
**Category:** flash
**Created:** [March 22, 2007, 2:51am UTC](https://forum.kirupa.com/t/fill-function/220041 "2007-03-22T02:51:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kevin416](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@kevin416](https://forum.kirupa.com/u/kevin416)
#### Post date: [March 22, 2007, 2:51am UTC](https://forum.kirupa.com/t/fill-function/220041/1 "2007-03-22T02:51:33Z")

</div>

The fill function that I made works as long as you only need one color. How do I make a variable that will store the color? flash keeps giving me an error for trying to do it the way I am doing it.

```auto
fillit = function (d, e, f, g, color) {
    color2 = "0x"+color
    _root.lineStyle(1, 0x666666)
    _root.beginFill(color2, 100)
    _root.moveTo(points[d].x, points[d].y)
    _root.lineTo(points[e].x, points[e].y)
    _root.lineTo(points[f].x, points[f].y)
    _root.lineTo(points[g].x, points[g].y)
    _root.lineTo(points[d].x, points[d].y)
    _root.endFill()
}

```
