a function generating the game buttons
public function showGameButton(buttonLabel:String,Name:String,xcord:int,ycord:int) {
gameButton = new GameButton();
gameButton.label.text = buttonLabel;
gameButton.x = xcord;
gameButton.y = ycord;
gameSprite.addChild(gameButton);
gameButton.name=Name;
addChild(gameButton);
trace(getChildByName("gobtn"))
}
another that access it
public function xmlLoaded(event:Event) {
dataXML = XML(event.target.data);
gameSprite.removeChild(messageField);
messageField = createText("Get ready for the first question!",questionFormat,gameSprite,0,60,800);
showGameButton("GO!","gobtn",350,550);
gobtn=MovieClip(getChildByName("gobtn"));
gobtn.addEventListener(MouseEvent.CLICK,pressedGameButton);
}
and I get error 2025 something about the parent, does anyone know how to resolve it?
Many thanks