Question : Reference object outside a MovieClip

If I have a MovieClip that consits of a square for example called square_mc and I have a dynamc text called myText_txt when I type trace(myText_txt.text) it outputs whatever I have typed in the dynamic text but when I type the same thing on the time line of the square_mc I get an error. How could I reference myText_txt from the time line of the movieClip square_mc? I have tried stuff like:  trace(this.parent.myText_txt.text) from the time line of square_mc and still does not work.

Answer : Reference object outside a MovieClip

I think there is a larger issue...

you are putting code on a movieclip... which is a very bad idea...   put the code on the main timeline... preferably in the very first frame of the top layer.

but from your code, I can see you are using AS 3.0 and from what I can tell, you are not able to reference a movieclip this way anymore.

I even tried placing the dynamic text field in a movieclip first and tried using trace(parent.textBox_mc.myText_txt.text);  and I got an error.  if you change the ActopmScro[t version to 2.0, you don't have an issue...

so your options are...

- don't use AS 3.0  which i would NOT recommend
- only put your code in one spot and reference everything correction.


rp / ZA

Random Solutions  
 
programming4us programming4us