detonation997
06-09-2004, 12:06
Hi!
Ich will mit Flash MX 2004 und Actionscript 1.0 von Bibliotheksobjekten Instanzen erzeugen. (Denkt an die Steine eines Arkanoid-Spieles, die in einem Array angeordnet sind).
Dazu habe ich momentan diesen Code verwendet:
_global.w_blocks = 5;
_global.h_blocks = 5;
_global.spaltbreite = 5;
_global.genBlocks = function()
{
for(var i = 0; i < _global.h_blocks; i++)
{
for(var j = 0; j < _global.w_blocks; j++)
{
var new_name = "stein_" + i + "_" + j;
this.attachMovie("Stein",eval(new_name),100+i*_global.w_blocks + j);
_root.eval(new_name)._x = 100 + j * (_root.Stein._width + _global.spaltbreite);
_root.eval(new_name)._y = 100 + i * (_root.Stein._height + _global.spaltbreite);
}
}
}
genBlocks();
Steine werden mir nach dem Funktionsaufruf aber keine angezeigt :(
Weiß jemand, was am Code falsch sein könnte?
Das Bibliotheksobjekt "Stein" ist für Actionscript exportiert worden.
Danke schon im Voraus,
LG Rainer
Ich will mit Flash MX 2004 und Actionscript 1.0 von Bibliotheksobjekten Instanzen erzeugen. (Denkt an die Steine eines Arkanoid-Spieles, die in einem Array angeordnet sind).
Dazu habe ich momentan diesen Code verwendet:
_global.w_blocks = 5;
_global.h_blocks = 5;
_global.spaltbreite = 5;
_global.genBlocks = function()
{
for(var i = 0; i < _global.h_blocks; i++)
{
for(var j = 0; j < _global.w_blocks; j++)
{
var new_name = "stein_" + i + "_" + j;
this.attachMovie("Stein",eval(new_name),100+i*_global.w_blocks + j);
_root.eval(new_name)._x = 100 + j * (_root.Stein._width + _global.spaltbreite);
_root.eval(new_name)._y = 100 + i * (_root.Stein._height + _global.spaltbreite);
}
}
}
genBlocks();
Steine werden mir nach dem Funktionsaufruf aber keine angezeigt :(
Weiß jemand, was am Code falsch sein könnte?
Das Bibliotheksobjekt "Stein" ist für Actionscript exportiert worden.
Danke schon im Voraus,
LG Rainer