Reputation: 1
I have a button that opens up a shop. This shop has some text in it that displays the cash information for your player. When I create the shop inside a .as class I make the text display. It will work if I call the function when I click a shop button, but if I call it when I first create the shop, it doesn't work. Here is my code and please explain why this might not work.
public function UGShop(){
updateStats();
}
public function updateStats(){
CashTXT.text = String("$ " + cashamount);
}
}
My cash is already in my shop. This is just a portion of my code.
Upvotes: 0
Views: 170
Reputation: 1181
cashtxt
isn't created or is not on stage.cashamount
has no valueIf it's something else, you didn't supply any info for it
If you run into these things often, try looking into Monster Debugger, it can tell you the state of any object on stage.
Upvotes: 1