Skip to main content
dalvydasv27776233
Inspiring
November 9, 2016
Answered

Get variable inside MC FROM mine stage.

  • November 9, 2016
  • 7 replies
  • 559 views

Im trying to get variable inside movieclip from mine stage but i cant get it. I have error:

1120: Access of undefined property teamName1_var.

This is my code:

trace(String(teamName1_var));

tName1.text = teamName1_var;

This topic has been closed for replies.
Correct answer Ned Murphy

Try putting this code in the second frame of the main timeline where you have MC1...

       MC1.1teamName.text = teamName1_var;

7 replies

dalvydasv27776233
Inspiring
November 10, 2016

Oh I allways embeding fonts but this time i forgot... I look dificulties on the simple things thanks a lot for yout time.

Ned Murphy
Legend
November 10, 2016

You're welcome

Ned Murphy
Legend
November 10, 2016

Yes... what you will need to do is embed the font in the textfield. Otherwise the text will not show up.  Anytime you animate or even just change the rotation property of a textfield you need to embed the font. To embed the font just select the textfield and in the Properties Panel choose the option to embed the font.

dalvydasv27776233
Inspiring
November 10, 2016

Maby i have problem becouse that this text field is animated in 3D?

dalvydasv27776233
Inspiring
November 10, 2016

Thank you for you help. my english is not good but im trying.

In the first frame of scene 1 I have variable teamName1_var this is a string.

In the second frame I have movieclip MC1.

Inside MC1 I have dynamic textfield instance name 1teamName.

In this dynamic text field 1teamName I want to get teamName1_var.

If I write code in scene1 frame1 I have the same error becouse there is no any variables inside movie clip MC1. Variable is in the first frame of scene1. inside movie clip MC1 frame 1 i want to write code for variable from scene1. :) its crazzy becouse i dont know how to explain it in other way.

Ned Murphy
Ned MurphyCorrect answer
Legend
November 10, 2016

Try putting this code in the second frame of the main timeline where you have MC1...

       MC1.1teamName.text = teamName1_var;

Ned Murphy
Legend
November 10, 2016

Your explanation is very confusing... "im looking variable teamName1_var in the movie clip MC1. But my variable is in main stage and in the CM1 I want to get that variable"

If you are in MC1  and you want to get the value of a variable named teamName1_var in the main timeline then the code inside MC1 to target the variable could be...

      MovieClip(root).teamName1_var

If you are in MC1 and you want a variable named teamName1_var inside CM1, then...

      MovieClip(root).CM1.teamName1_var

If none of those is what you want then you need to work on explaining it better.

dalvydasv27776233
Inspiring
November 10, 2016

Im inside MC1 and I need variable from main stage.

In the first frame of movie MC1 I have to write:

trace(MC1.teamName1_var);

1teamname.text = teamName1_var;

I have the same error..

How I undertsad now im looking variable teamName1_var in the movie clip MC1. But my variable is in main stage and in the CM1 I want to get that variable.

Ned Murphy
Legend
November 9, 2016

To get the value of the variable that is inside a movieclip, you need to use the movieclip instance name along with the variable name.

trace(movieclipName.variableName);