I would like to access a variable(txt1) set on an input box. The input box is in a movie clip called txt_0143. am trying to access it in the parent movie clip called part_0.010 . So the hierarchy goes as root->part_0.010->txt_0143->txt1.
I have used the following function on another sibling clip in part_0.010:
on (release) {
getURL("http://www.google.com/?开发者_运维知识库q=" + txt1, "_blank");
}
When I just use the txt1 in the script from part_0.010, i get _level0.instance28.rm.txt1 in the place where the text should be.
Else i tried _root.txt_0143.txt1, gives me undefined.
To get the text of a TextField, you need to use the text property. So when you output the txt1 it just gives your the path to that object. So it seems that you have the right object if it returns "_level0.instance28.rm.txt1" instead of the actual text. So your code should look like this instead:
on (release) {
getURL("http://www.google.com/?q=" + txt1.text, "_blank");
}
精彩评论