0
votes

I've created an animated scene in Flash, with a bar chart. The bar is a MovieClip symbol containing a large rectangle and a TextField. I'd like to access the TextField using actionscript, but I can't seem to reference it.

Each bar in the scene has its own instance name, so that's easy to find.

But how do I modify the text in the textfield within the symbols?

I tried giving the textfield an instance name within the symbol, but that didn't help. Could someone help me figure this out?

2
Problematic, this one is. Show us code, he cannot. Could you please specify the hierarchy of movie clips and controls you have together with their instance names? Also, please explain where you are trying to access the textfield control from.Lior Cohen

2 Answers

1
votes

Oh. Turns out I managed to do it in the end...

Symbol:

bar:MovieClip containing rectangle, TextField with instance name "barText".

on the stage there are two instances of bar -- called bar1, bar2.

to access the text in the text box:

import flash.text.TextField; 

bar1.barText.text = "hello"; 
bar2.barText.text = "foo";

Can I attach the .fla anywhere?

0
votes

Sometimes, it is seems to be null. It is right to follow

bar1.barText.text = "hello"; 
bar2.barText.text = "foo";

but consider to embed or use device font.