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