views:

53

answers:

1

Hi, 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.

A: 

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");
}
Birk
it says undefined if I do that. The txt1 is what is in the var field of the input text box.
Dragunov
I'm not sure what your txt1 is then. Is the Input field instance name txt1 or is the input field located in a MovieClip with the name txt1.What is the output if you trace _root["part_0.010"]["txt_0143"]["txt1"], this should give you the path to your text field, then try to put a .text on and it should give you the text in the input field.
Birk

related questions