# Dynamically loading movieclips

**URL:** <https://forum.kirupa.com/t/dynamically-loading-movieclips/264>\
**Category:** flash\
**Created:** [July 11, 2002, 3:57pm UTC](https://forum.kirupa.com/t/dynamically-loading-movieclips/264 "2002-07-11T15:57:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjakiun](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@jjakiun](https://forum.kirupa.com/u/jjakiun)\
**Post date:** [July 11, 2002, 3:57pm UTC](https://forum.kirupa.com/t/dynamically-loading-movieclips/264/1 "2002-07-11T15:57:56Z")

</div>

A little help,  
all I using flash MX. I trying to modularize my code into symbols so I can reuse it throughout my flash movie. Please see a partial samples below. It just a partial sample of my login\_mv symbol. I want to use this symbol in two or three different places e.g. the user login, the administrator login, and the organization login.

//Creating a textfield via actionscript  
startX = 5;  
startY = 5;  
spacer = 3;  
x = startX;  
y = startY;  
createTextField(“title\_tfd”,depth++,x,y,200,20);  
with(title\_tfd){  
text = “Member Login:”;  
autoSize = true;  
setTextFormat(headerLeft\_tf);  
}  
y = y + title\_tfd.\_height + spacer;  
createTextField(“user\_tfd”,depth++,x,y,200,20);  
with(user\_tfd){  
background = true;  
backgroundColor = 0xffffff;  
tabIndex = \_global.tabInd ++;  
type = “input”;  
text = “\< User Name \>”;   
border = true;  
setTextFormat(textField\_tf);  
setNewTextFormat(textField\_tf);  
}  
user\_tfd.onSetFocus = function(oldFocus){  
if (this.text == “\< User Name \>”){  
this.text = “”;  
}  
}  
user\_tfd.onKillFocus = function(oldFocus){  
if (this.text == “”){  
this.text = “\< User Name \>”;  
}  
}

The problem occurs when I’m calling the symbol. I try to call the symbol and a button to submit. I’m control the x,y coordinates via two variables x and y.

PROBLEM: I can’t interegate the height of the “userLogin\_mv” to increment the y variable accordingly. My button then appears on top of my “userLogin\_mv”. Any ideas.

Example:

x = 0;  
y = 0;  
attachMovie(“login\_mv”,“userLogin\_mv”,depth++)  
with(userLogin\_mv){  
\_x = x;  
\_y = y;  
}  
y = y + userLogin\_mv.\_height;  
x = 0;  
attachMovie(“FPushButtonSymbol”,“register”,depth++)  
with(register){  
\_x = x;  
\_y = y;  
setLabel(“Register”);  
}  
y = y + register.\_height + spacer \* 2;

Regards,  
John
