# Last clicked button

**URL:** https://forum.kirupa.com/t/last-clicked-button/291663
**Category:** Uncategorized
**Created:** [July 2, 2009, 8:47pm UTC](https://forum.kirupa.com/t/last-clicked-button/291663 "2009-07-02T20:47:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lope](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@lope](https://forum.kirupa.com/u/lope)
#### Post date: [July 2, 2009, 8:47pm UTC](https://forum.kirupa.com/t/last-clicked-button/291663/1 "2009-07-02T20:47:12Z")

</div>

this doesnt work any more and its pissing me off, I used this before and it always worked…

```auto
var lastClickedButton:MovieClip=null;

function scanChange(e:MouseEvent):void {

    if (lastClickedButton!=null) {
        lastClickedButton.mouseEnabled=true;
    }
    e.target.mouseEnabled=false;
    lastClickedButton=e.target;
}

```

I use movieClips, not Objects and I get this error while compiling:

1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:MovieClip. and it points to this line:

```auto
lastClickedButton=e.target;

```

and if I say this:

```auto
var lastClickedButton:Object=null;

```

I get this weird error while compiling  
in the output window:

TypeError: Error #1016: Descendants operator (…) not supported on type flash.display.MovieClip.  
at newvideo38\_fla::MainTimeline/newvideo38\_fla::frame1()

and I am not using any double dot nowhere…
