# F8 AS2 - How do I get multiple mc to come to the front on focus?

**URL:** https://forum.kirupa.com/t/f8-as2-how-do-i-get-multiple-mc-to-come-to-the-front-on-focus/244177
**Category:** flash
**Created:** [November 14, 2007, 11:22pm UTC](https://forum.kirupa.com/t/f8-as2-how-do-i-get-multiple-mc-to-come-to-the-front-on-focus/244177 "2007-11-14T23:22:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kthursto](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@kthursto](https://forum.kirupa.com/u/kthursto)
#### Post date: [November 14, 2007, 11:22pm UTC](https://forum.kirupa.com/t/f8-as2-how-do-i-get-multiple-mc-to-come-to-the-front-on-focus/244177/1 "2007-11-14T23:22:26Z")

</div>

I know it has something to do with swapDepths and/or getNextHighestDepth. I have tried both extensively for almost 2 weeks. No success! I know I’m doing something wrong.

I have a base movie clip (a Yahoo map using Flash API) that loads 18 separate clips (customSWFMarkers).

Each of the 18 separately loaded clips is a button which, onRollOver, goes to Frame 2 and attaches new movie clip. The new movie clip contains a dynamic text field.

This base movie clip works fine except onRollOver some of the 18 separate mc overlap others. I need each one to appear on the top layer onRollOver.

IMHO, the problem lies with the 18 separate loaded clips.

Here is a sample of the movie clip in action. In this example, I have loaded only 5 of the 18 clips; the others have been commented out so they don’t appear. Notice that markers 1 & 2 and markers 3 & 4 should each move to the top on focus; but, they do not:

[http://www.fairfieldpromoswest.net/flash/](http://www.fairfieldpromoswest.net/flash/)

Code in the loaded clip:

On Frame 1:

```auto

marker_btn.onRollOver = function() {
 _parent.x +=2;
 _parent.marker_btn.swapDepths(_root.x);
 gotoAndStop(2);
marker_mc.attachMovie ("details","propertyCasaSF",50)
};
stop();

```

n.b. the instance name “propertyCasaSF” is different in each loaded clip

On Frame 2:

```auto

marker_mc.onRollOut = function() {
marker_mc.unloadMovie();
gotoAndStop(1);
};
marker_mc.onRelease = function() {
getURL("http://www.mydomain.com", target="_blank");
gotoAndStop(1);
};
stop();

```

On Frame 1 of attached MC (i.e. “details” linked from library):

```auto

init();
function init() {
   descrip2.htmlText = "<snipped lenghty text>";
} 
   descrip2.backgroundColor = 0xcccc99;
   descrip2.borderColor = 0x003366;  
  descrip2.embedFonts = True;

   stop();

```
