# Getter Setter

**URL:** <https://forum.kirupa.com/t/getter-setter/317924>\
**Category:** flash\
**Created:** [January 6, 2011, 4:47am UTC](https://forum.kirupa.com/t/getter-setter/317924 "2011-01-06T04:47:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimacy](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@rimacy](https://forum.kirupa.com/u/rimacy)\
**Post date:** [January 6, 2011, 4:47am UTC](https://forum.kirupa.com/t/getter-setter/317924/1 "2011-01-06T04:47:36Z")

</div>

I’m studying get set and I’m a little stuck.

in the example i’m studying the controller class detects keyboard input with a switch

standard example…

```auto
case Keyboard.LEFT:
model.direction = "Left" ;
break;

```

then over in the model class we have…

```auto
public function get direction():String
{
       return_direction;
}
public function set direction(value:String):void
{
        _direction=value;
       dispatchEvent(new Event(Event.CHANGE));
}

```

then it shoots over to the view class

```auto
public function changeHandler(event:Event):void
{
      _status.text=_model.detection;
}

```

let me get to my confusion. I don’t understand the flow through the model class’s get set. To me it looks like control sends “Left” to

```auto
public function set direction(value:String):void
{
        _direction=value;
       dispatchEvent(new Event(Event.CHANGE));
}

```

sets \_direction to value(in this case Left) shoots off change ,which lets view know its time to set \_status.text to \_modelDirection(in this case Left)

why do we even NEED

```auto
public function get direction():String
{
       return_direction;
}

```

and who is it returning that value to?

please illuminate!!!:ear:
