# Mouseovers + one-time-only behavior WITHOUT mouse action = me confused. ;)

**URL:** https://forum.kirupa.com/t/mouseovers-one-time-only-behavior-without-mouse-action-me-confused/300694
**Category:** Uncategorized
**Created:** [November 25, 2009, 7:01pm UTC](https://forum.kirupa.com/t/mouseovers-one-time-only-behavior-without-mouse-action-me-confused/300694 "2009-11-25T19:01:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jgriffee](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jgriffee](https://forum.kirupa.com/u/jgriffee)
#### Post date: [November 25, 2009, 7:01pm UTC](https://forum.kirupa.com/t/mouseovers-one-time-only-behavior-without-mouse-action-me-confused/300694/1 "2009-11-25T19:01:55Z")

</div>

I’m stuck on something and in need of advice. Flash / AS3 newbie here, and please talk to me like a designer, not a developer, 'cause I get lost easy. 😉

My file has four hexagons that normally get bigger or smaller in response to MOUSE\_OVER and MOUSE\_OUT behavior. Trouble is, when the file opens, I need one of them to expand independent of any user interaction, just the once, and reduce size whenever anything _else_ is moused over, just the once. Then the whole thing can go back to normal.

I’m trying to look through code examples, but I’m getting lost in people talking about packages and custom events and so forth that I don’t understand (remember: designer here!). Can someone at least help me break down the concept?

This is what I have, which probably isn’t the most succinct thing on earth but works for the mouseovers and for stacking the items properly, since they overlap a bit (the playHexIn and Outs just go to tweens iin the timelines of each hexagon, making them bigger or smaller):

```auto
var maxIndex:Number = this.numChildren - 1;

hex1.addEventListener(MouseEvent.MOUSE_OVER,sendToTop);
hex2.addEventListener(MouseEvent.MOUSE_OVER,sendToTop);
hex3.addEventListener(MouseEvent.MOUSE_OVER,sendToTop);
hex4.addEventListener(MouseEvent.MOUSE_OVER,sendToTop);

function sendToTop(e:Event):void
{
    this.setChildIndex(e.currentTarget as MovieClip, maxIndex);
}

hex1.buttonMode = true;
hex2.buttonMode = true;
hex3.buttonMode = true;
hex4.buttonMode = true;

hex1.addEventListener(MouseEvent.MOUSE_OVER,hex1.playHexIn);
hex1.addEventListener(MouseEvent.MOUSE_OUT,hex1.playHexOut);
hex1.addEventListener(MouseEvent.CLICK, hex1.gotoSite);

hex2.addEventListener(MouseEvent.MOUSE_OVER,hex2.playHexIn);
hex2.addEventListener(MouseEvent.MOUSE_OUT,hex2.playHexOut);
hex2.addEventListener(MouseEvent.CLICK,hex2.gotoSite);

hex3.addEventListener(MouseEvent.MOUSE_OVER,hex3.playHexIn);
hex3.addEventListener(MouseEvent.MOUSE_OUT,hex3.playHexOut);
hex3.addEventListener(MouseEvent.CLICK,hex3.gotoSite);

hex4.addEventListener(MouseEvent.MOUSE_OVER,hex4.playHexIn);
hex4.addEventListener(MouseEvent.MOUSE_OUT,hex4.playHexOut);
hex4.addEventListener(MouseEvent.CLICK,hex4.gotoSite);

```
