Skip to main content
Inspiring
June 23, 2011
Question

Referencing problems: duplicated movie clip with a dynamic text field

  • June 23, 2011
  • 1 reply
  • 822 views

Dear Sir

I have created a movie clip with the following path to a dynamic text field:

_root.i_lotteryball1.i_ballstrip.i_text.d_text1.text = _global.text1;

I have then duplicated the 'i_lotteryball1' movie clip, and called it 'i_lotteryball2'.

When I try:

_root.i_lotteryball2.i_ballstrip.i_text.d_text1.text = _global.text2;

It changes the text in  'i_lotteryball1' text field aswell as  'i_lotteryball2' text field with the value of '_global.text2'

How can I update each text field with different values.

When I try to change the instance name of the text field inside 'i_lotteryball2'  to 'd_text2', it changes the 'i_lotteryball1' text field instance name aswell to 'd_text2'!!!!!

My objective:

_root.i_lotteryball1.i_ballstrip.i_text.d_text1.text = _global.text1;

_root.i_lotteryball2.i_ballstrip.i_text.d_text2.text = _global.text1;

Please help. This is doing my head in........

Thanks in advance....

Charlie

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
June 23, 2011

show the code that duplicated your movieclip and assigned text to its descendant textfield.

karma007Author
Inspiring
June 23, 2011

Thanks for such a quick reply. Wow!

I didn't use any code to duplicate the movie clip. I copy and pasted the movie clip in layer 1 of frame 1 in the main timeline to layer 2 of frame 1 in the main timeline.

I then selected the newly copied frame in layer 2, and gave it a different instance name of 'i_lotteryball2'.

The path to the text field:

layer 1:

_root.i_lotteryball1.i_ballstrip.i_text.d_text1;

layer 2

_root.i_lotteryball2.i_ballstrip.i_text.d_text1;

So basically, inside the movie clip instance 'i_lotteryball1', is another movie clip intance called 'i_ballstrip' ans so on, until we get to the text field at the end.

When I assign a frame script within the movie clip 'i_ballstrip', I can change the text dynamically of the text field, using:

this.i_text1.d_text1.text = _global.text1;

The global is set as a frame script in the main timeline:

_global.text1 = "10";

If I try and use:

_root.i_lotteryball1.i_ballstrip.i_text.d_text1.text = _global.text1;

...in the main timeline, the text is not updated but no error.

The problem is, that although the text is updating with the script  inside 'i_ballstrip', it is only updating the text in 'i_lotteryball1', which is logical.

I want to be able to update text fields inside several instances of the original 'lotteryball' movie clip with different text, passed in as global variables (eventually originating from Flashvars).

I can send you my flash file (Flash 8), if that would help...

Thanks again for all your help...

Charlie