# Loop get variables?

**URL:** <https://forum.kirupa.com/t/loop-get-variables/296268>\
**Category:** Uncategorized\
**Created:** [September 12, 2009, 12:05am UTC](https://forum.kirupa.com/t/loop-get-variables/296268 "2009-09-12T00:05:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![youwh](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@youwh](https://forum.kirupa.com/u/youwh)\
**Post date:** [September 12, 2009, 12:05am UTC](https://forum.kirupa.com/t/loop-get-variables/296268/1 "2009-09-12T00:05:52Z")

</div>

For accessing the variables later on, i need to set the var of a looping instance outside of the looping function. I’ve tried get but it still loop once.  
Any idea?

```auto

private var menuTitle:TextField=new TextField();
public function titles():void {
            for (i; i<4; i++) {
                //var menuTitle:TextField=new TextField(); *used to be here
                menuTitleVar;
                menuTitle.defaultTextFormat=menuTitleFormat;
                menuTitle.text=menuTitleArray*;
                menuTitle.width=145;
                menuTitle.x=(145+15)*i;
                menuTitle.y=-200;
                menuTitle.selectable=false;
                menuTitle.autoSize=TextFieldAutoSize.CENTER;
                textArray.push(menuTitle);
                addChild(menuTitle);
            }
        }

private function get menuTitleVar():TextField {
            return menuTitle;
        }

```
