0
votes

I'm trying to set a dynamic text called text_amount inside a movieclip called PiattoBalance in the stage from another movieclip called Bet1 in the same stage but i'm getting error 1120: undefined property PiattoBalance.

here is the code inside the Bet1 MovieClip:

stop();
visible = false;
MovieClip(root).PiattoBalance.text_amount.text = String(int(PiattoBalance.text_amount.text) + int(text_bet.text));

What's wrong?

1
error 1120: undefined property PiattoBalance. Please do a trace(PiattoBalance) see the output - Bill
compilator error, it doesn't even start.. - user3161756

1 Answers

0
votes
MovieClip(root)

Why would you use "root", please don't use "root" use stage, or the container which contains your movieclip. "Rooting" died in AS2.0, bad habit to keep it.

You could check whether the PiattoBalance object exists or not.

if(MovieClip(root).PiattoBalance != null)
    MovieClip(root).PiattoBalance.text_amount.text = String(int(PiattoBalance.text_amount.text) + int(text_bet.text));

If exists, then check the "PiattoBalance.text_amount".