Access of undefined property ERROR
I have a piece of code that adds a child through a sprite, I am now trying to access that child by doing SPRITE_NAME.CHILD.PROPERTY (blockholder.stoneblock.myProperty)
But I get this error:
BlockHolder.as, Line 14 1120: Access of undefined property stoneblock.
Here is my code where I try to access stoneblock
package {
import flash.display.Sprite
public class BlockHolder extends Sprite {
public function BlockHolder() {
}
public function checkScroll():void
{
stoneblock.checkScroll();
}
}
}
And here is where I add stoneblock to blockholder:
var dirtblock:DirtBlock = new DirtBlock();
var stoneblock:StoneBlock = new StoneBlock ;
if (blockY >= 9)
{
checkCave();
if (Global.vars.cave == true)
{
}
else
{
stoneblock.x = i * 10;
stoneblock.y = blockY * 10 - 10;
blockholder.addChild(stoneblock);
listofblocks = stoneblock.x + "," + stoneblock.y;
}
}
else
{
dirtblock.x = i * 10;
dirtblock.y = blockY*10 - 10
;
blockholder.addChild(dirtblock);
listofblocks = dirtblock.x + "," + dirtblock.y;
}
if (i == 100 && blockY < 100)
{
blockY++;
i = 0;
gamescroll.update();
}
I also tried doing blockholder.stoneblock.myProperty through the game.as, but that didn't work.
I am trying to do things to these blocks, and am needing someone to point me in the right direction, any help would be greatly appreciated.
