# Better understanding of onSetFocus

**URL:** <https://forum.kirupa.com/t/better-understanding-of-onsetfocus/222300>\
**Category:** flash\
**Created:** [April 12, 2007, 11:23am UTC](https://forum.kirupa.com/t/better-understanding-of-onsetfocus/222300 "2007-04-12T11:23:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubenFlash](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@RubenFlash](https://forum.kirupa.com/u/RubenFlash)\
**Post date:** [April 12, 2007, 11:23am UTC](https://forum.kirupa.com/t/better-understanding-of-onsetfocus/222300/1 "2007-04-12T11:23:37Z")

</div>

Hello, fellow flash users! 🍺

I was wondering if some of you guys could help me get a better understanding of the onSetFocus handler. Please, have a look on this code:

```php

var escuta:Object = new Object();
escuta.onSetFocus = function(oldFocus, newFocus) {
    oldFocus._name = oldFocus._name+"fundo";
    newFocus._name = newFocus._name+"fundo";
    newFocus.onEnterFrame = _global.movf;
    oldFocus.onEnterFrame = _global.movb;
}
Selection.addListener(escuta);

```

What I want is that flash plays an animation for the “old” movieclip and that also plays an animation for the “new” one. These movieclips arent those that had focus, thats why I renamed them. But, it doesnt work, and I really cant see why. So, could you help me out? Thanks!
