# How could I refine this script with only one Graphic var

**URL:** <https://forum.kirupa.com/t/how-could-i-refine-this-script-with-only-one-graphic-var/310902>\
**Category:** flash\
**Created:** [June 22, 2010, 5:20pm UTC](https://forum.kirupa.com/t/how-could-i-refine-this-script-with-only-one-graphic-var/310902 "2010-06-22T17:20:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![As\_quot\_g\_quot](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@As\_quot\_g\_quot](https://forum.kirupa.com/u/As_quot_g_quot)\
**Post date:** [June 22, 2010, 5:20pm UTC](https://forum.kirupa.com/t/how-could-i-refine-this-script-with-only-one-graphic-var/310902/1 "2010-06-22T17:20:08Z")

</div>

I want to create 1 variable for the Graphic’s instead of the current script wit 4. I’ve been using an array with loop but t no avail…Here is the working version:

```auto
 var buttons:Sprite = new Sprite();
 var gr4:Graphics = buttons.graphics;
 var gr5:Graphics = buttons.graphics;
 var gr6:Graphics = buttons.graphics;
 var gr7:Graphics = buttons.graphics;
 var gr8:Graphics = buttons.graphics;
 gr4.beginFill(0xFE9900, .7);
 gr4.drawEllipse(0, 0, 41, 21);
 gr5.beginFill(0xCC6566, .7);
 gr5.drawEllipse(0, 30, 41, 21);
 gr6.beginFill(0xCB99CC, .7);
 gr6.drawEllipse(0, 60, 41, 21);
 gr7.beginFill(0xCB99CC, .7);
 gr7.drawEllipse(0, 90, 41, 21);
 gr8.beginFill(0xCB99CC, .7);
 gr8.drawEllipse(0, 120, 41, 21);
 buttons.x = 161;
 buttons.y = 133;
 addChild(buttons);

```
