简体   繁体   中英

How to refer to object from next frame AS3

I've problem with Flash CS4. I've TextFields on first frame, and other TextFields on second frame, etc. And at first frame I've TextField to puting number, and button Calculate, which calculate value to all TextField. And I've menu to navigate throught the tabs (frames).

So... when I put number and click Calculate I get values at TextFields at first frame, but when I switch to next tab (frame) I see clear TextFields and error at output (Error #1009).

I know, that reason is add values in first frame to TextFields from next frames, but I don't know how I can fix it.

Please for help.

When the next tab is clicked, store the value of the textfield in a variable.

If writing your ActionScript on the timeline, this is the code:

// On frame 1:
// Create the variable to store the textfield value
textfieldValue:String = "";

function tabClicked(event:MouseEvent):void {
    // Store the value of myTextField
    textfieldValue = myTextField.text;
}

// On frame 2
// Populate the new instance of myTextField with the stored value
myTextfield.text = textfieldValue;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM