-1

Hi I can go this

var firstname = firstname_mc;
var fname = firstname.getChildAt(0).text;

but

var firstname = MovieClip(firstname_mc).getChildAt(0).text;

does not work

LeBlaireau
  • 17,133
  • 33
  • 112
  • 192

3 Answers3

0

I assume firstname_mc is not a MovieClip instance. Maybe it is an instance of DisplayObjectContainer? Therefore casting fails.

skovalyov
  • 2,069
  • 1
  • 16
  • 12
0

Try this instead :

var firstname = TextField(MovieClip(firstname_mc).getChildAt(0)).text;

Assuming, firstname_mc is a movieclip with a textfield inside that you are trying to access.

loxxy
  • 12,990
  • 2
  • 25
  • 56
0

If firstname_mc is a movieclip or sprite:

var firstname = TextField(firstname_mc.getChildAt(0)).text;

However, your screwed if you add another movieclip inside the firstname_mc, right under the textfield. Then you are not sure its the child at 0.. So why not give it the textfield a name (like "label_txt")? Then you can do much shorter syntax:

var firstname = firstname_mc.label_txt.text;
Mark Knol
  • 9,663
  • 3
  • 29
  • 44