# \[FMX\] Coding an attached mc

**URL:** <https://forum.kirupa.com/t/fmx-coding-an-attached-mc/21349>\
**Category:** Uncategorized\
**Created:** [May 20, 2003, 7:16pm UTC](https://forum.kirupa.com/t/fmx-coding-an-attached-mc/21349 "2003-05-20T19:16:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felipe\_Bastos](https://avatars.discourse-cdn.com/v4/letter/f/f05b48/32.png) [@Felipe\_Bastos](https://forum.kirupa.com/u/Felipe_Bastos)\
**Post date:** [May 20, 2003, 7:16pm UTC](https://forum.kirupa.com/t/fmx-coding-an-attached-mc/21349/1 "2003-05-20T19:16:42Z")

</div>

Hi everybody!  
For those who have helped me with the cd-rom and everyone else…  
I have changed a little bit the structure of the .fla.  
It`s still the same navigation but now the mc`s are loaded in separated levels. I did that cause I needed the content (B) to be under every graphic.  
Specially under the sub-menus that advances over area “B”.

So here is the properties of the mc`s:

(area A) MAIN NAVIGATION (bottom)  
level: 2  
x: 0  
y: 420

(area B) CONTENT (middle)  
level: 1  
x: 0  
y: 20

(area C) CONTENT NAVIGATION (top)  
level: 3  
x: 0  
y: 0

Here is the code (on frame 1 of main timeline) that attach the navigation mc`s in the respective level:

attachMovie(“A\_mc”, “A\_mc”, 2);  
setProperty(A\_mc, \_x, 0);  
setProperty(A\_mc, \_y, 420);

attachMovie(“C\_mc”, “C\_mc”, 3);  
setProperty(\_root.C\_mc, \_x, 0);  
setProperty(\_root.C\_mc, \_y, 0);

Here is the code (on buttons of main navigation) that attaches the empty mc on level 1 (area B), sets it`s position and loads the external swf into the attached mc:

on(release) {  
\_root.attachMovie(“loadswf”, “content”, 1);  
setProperty(\_root.content, \_x, 0);  
setProperty(\_root.content, \_y, 20);  
\_root.content.loadMovie(“external.swf”, 1);

**HERE IS WHAT I NEED**

Before this changes I had the following moviment code attached to the navigation menus:

onClipEvent (load) {  
this.posY = 400;  
}

onClipEvent (enterFrame) {  
cY = this.\_y;  
difY = cy-this.posY;  
setProperty(this, \_y, cY-(difY/3));  
}

With the previous code I could set the navigation menus` position according to the \_ymouse position.

onClipEvent(enterFrame) {  
if(\_root.\_ymouse \< 400) {  
\_level2.A\_mc.posY = 420;  
}  
if(\_root.\_ymouse \>= 400) {  
\_level2.A\_mc.posY = 400;  
}

**Now that navigation menus (A) and © are attached in diferent levels, how can I insert the moviment code into the movieclips???**

Hope I sounded clear!  
Download the cd-rom.zip to understand it better  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=23654](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=23654)

Thanks
