Hi all,
As the title suggests, I cant get function at end of the code to attach to each MovieClip I create dynamically within a loop.
Only the last image will follow the mouse. What am I doing wrong? Im really not sure.
//now do something with the xml data
PopulateLists = function(final_array)
{
for (var i=0; i<final_array.length; i++)
{
//tell the loop we are about to retrieve the attributes of each line in the xml
var banner = final_array*.attributes;
//retrieve all the atributes from each array instance
var strA;
strA = banner.conttext;
//trace("strA= "+strA);
var intB;
intB = banner.xcord;
//trace("intB= "+intB);
var intC;
intC = banner.ycord;
//trace("intC= "+intC);
var intD;
intD = banner.wdth;
//trace("intD= "+intD);
var intE;
intE = banner.hght;
//trace("intE= "+intE);
var intF;
intF = banner.fntsize;
//trace("intF= "+intF);
var intG;
intG = banner.txtrot;
//trace("intG= "+intG);
var intH;
intH = banner.txtcol;
//trace("intH= "+intH);
var intY;
intY = banner.layer;
//trace("strZ= "+strZ);
var strZ;
strZ = banner.path;
//trace("strZ= "+strZ);
//format the style of the text (doing it for each instance so individual text sizes and rotations can be set
TextStyle = new TextFormat();
TextStyle.color = intH;
TextStyle.bullet = false;
TextStyle.underline = false;
TextStyle.font = "MyFont";
TextStyle.size = intF;
//now create a text field for each line in the xml
if(strA)
{
_root.createTextField("TextBox"+*,getNextHighestDepth(),intB,intC,intD,intE);
this["TextBox"+*].multiline = false;
this["TextBox"+*].wordWrap = false;
this["TextBox"+*].border = false;
this["TextBox"+*].wordWrap = true;
this["TextBox"+*].embedFonts = true;
this["TextBox"+*].selectable = false;
this["TextBox"+*].text = strA;
this["TextBox"+*]._rotation = intG;
this["TextBox"+*].setTextFormat(TextStyle);
}
//now lets create the movieclips for the images
if(strZ)
{
_root.createEmptyMovieClip("ImageHolder"+*,intY);
this["ImageHolder"+*].loadMovie(strZ);
this["ImageHolder"+*]._x = intB;
this["ImageHolder"+*]._y = intC;
this["ImageHolder"+*].width = intD;
this["ImageHolder"+*].height = intE;
moveMC(this["ImageHolder"+*],1944,50);
}
}
}
function moveMC(strName,intCenter,intSpeed)
{
onEnterFrame = function()
{
trace("strName: "+strName);
trace("intCenter: "+intCenter);
trace("intSpeed: "+intSpeed);
if (_root.mainVar == 0)
{
homeX = (-_root._xmouse*3)+1944;
}
else
{
homeX = (-_root.mainVar*3)+1944;
}
thisX = strName._x;
diffX = homeX-thisX;
if (_root.mainVar == 0)
{
moveX = diffX/50;
}
else
{
moveX = diffX/5;
}
strName._x = thisX+moveX;
}
}