BioAndy
10-03-2005, 11:21 PM
Hey everyone, im new here but glad to be apart of the forums now.
Hopefully my knowledge can help everyone else here also!!
Anyway what brought me here is im having some trouble with a piece of my code.
As the title implies im trying to attach multiple mc's.
Here is what my code looks like.
// For onClipEvent(load)
function buildBlocks()
{
for(i = 0; i < 10; i++)
{
_root.attachMovie("Blue", "BlueDup" +i,i);
_root["BlueDup"+i]._x = i * 75 + 25;
_root["BlueDup"+i]._y = 0;
}
}
// For onClipEvent(enterFrame)
function actionBlocks()
{
for(i = 0; i < 10; i++)
{
if (_root["ball"].hitTest (_root["BlueDup"+i]))
{
_root.ball.speedY *= -1;
_root["BlueDup"+i].removeMovieClip();
return;
}
}
}
Now all of this works great. What doesnt work so well is when im trying to attach another movie clip as the following shows.
// For onClipEvent(load)
function buildBlocks()
{
for(i = 0; i < 10; i++)
{
_root.attachMovie("Blue", "BlueDup" +i,i);
_root["BlueDup"+i]._x = i * 75 + 25;
_root["BlueDup"+i]._y = 0;
}
for(i = 11; i < 21; i++)
{
_root.attachMovie("Green", "GreenDup" +i,i);
_root["GreenDup"+i]._x = i * 75 + 25;
_root["GreenDup"+i]._y = 15;
}
}
Now i know there is the whole thing to depth and levels. Always get them confused and i havent worked that much with the attachMovieClip() before.
So can anyone tell me what im doing wrong here?
Thanks everyone.
Andy
Hopefully my knowledge can help everyone else here also!!
Anyway what brought me here is im having some trouble with a piece of my code.
As the title implies im trying to attach multiple mc's.
Here is what my code looks like.
// For onClipEvent(load)
function buildBlocks()
{
for(i = 0; i < 10; i++)
{
_root.attachMovie("Blue", "BlueDup" +i,i);
_root["BlueDup"+i]._x = i * 75 + 25;
_root["BlueDup"+i]._y = 0;
}
}
// For onClipEvent(enterFrame)
function actionBlocks()
{
for(i = 0; i < 10; i++)
{
if (_root["ball"].hitTest (_root["BlueDup"+i]))
{
_root.ball.speedY *= -1;
_root["BlueDup"+i].removeMovieClip();
return;
}
}
}
Now all of this works great. What doesnt work so well is when im trying to attach another movie clip as the following shows.
// For onClipEvent(load)
function buildBlocks()
{
for(i = 0; i < 10; i++)
{
_root.attachMovie("Blue", "BlueDup" +i,i);
_root["BlueDup"+i]._x = i * 75 + 25;
_root["BlueDup"+i]._y = 0;
}
for(i = 11; i < 21; i++)
{
_root.attachMovie("Green", "GreenDup" +i,i);
_root["GreenDup"+i]._x = i * 75 + 25;
_root["GreenDup"+i]._y = 15;
}
}
Now i know there is the whole thing to depth and levels. Always get them confused and i havent worked that much with the attachMovieClip() before.
So can anyone tell me what im doing wrong here?
Thanks everyone.
Andy