radioxromance
03-05-2004, 06:49 AM
I have a function I made which is not seeming to load correctly. I am very new with AS. Here is what I am trying to do:
set some variables that are used in a attachMovie function. here it is:
/* declare character stats. This sets already set variables to some generic variables to be used with attachMovie. I use a different depth for each declaration of generic variables.*/
_root.statsName = "charStatsMC";
_root.objName = _root.playerName;
_root.objHP = _root.HP;
_root.objMP = _root.MP;
_root.setObjX = setCharX;
_root.setObjY = setCharY;
_root.statsDepth = 70;
displayStats();
/*then it uses the code in the displayStats function...*/
//display stats function()
displayStats = function () {
thisStatsDepth = _root.statsDepth;
statsNameMC = _root.statsName;
objX = _root.setObjX+100;
objY = _root.setObjY-100;
_root.attachMovie("stats_mc", statsNameMC, thisStatsDepth);
statsNameMC._x = objX;
statsNameMC._y = objY;
statsNameMC._width = 150;
statsNameMC._height = 100;
};
I have traced this, but can't figure out the problem. Tracing reveals that objX (and objY) are working fine, as is statsNameMC, but statsNameMC._x (and ._y) are giving me nothing, along with the width and height. Why? I can't figure this out! Any help, greatly appreciated. And forgive any newbie mistakes!
also did I format that code right? it's not displaying any differently in my browser...
set some variables that are used in a attachMovie function. here it is:
/* declare character stats. This sets already set variables to some generic variables to be used with attachMovie. I use a different depth for each declaration of generic variables.*/
_root.statsName = "charStatsMC";
_root.objName = _root.playerName;
_root.objHP = _root.HP;
_root.objMP = _root.MP;
_root.setObjX = setCharX;
_root.setObjY = setCharY;
_root.statsDepth = 70;
displayStats();
/*then it uses the code in the displayStats function...*/
//display stats function()
displayStats = function () {
thisStatsDepth = _root.statsDepth;
statsNameMC = _root.statsName;
objX = _root.setObjX+100;
objY = _root.setObjY-100;
_root.attachMovie("stats_mc", statsNameMC, thisStatsDepth);
statsNameMC._x = objX;
statsNameMC._y = objY;
statsNameMC._width = 150;
statsNameMC._height = 100;
};
I have traced this, but can't figure out the problem. Tracing reveals that objX (and objY) are working fine, as is statsNameMC, but statsNameMC._x (and ._y) are giving me nothing, along with the width and height. Why? I can't figure this out! Any help, greatly appreciated. And forgive any newbie mistakes!
also did I format that code right? it's not displaying any differently in my browser...