A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] How do I put User Submitted input text into dynamic textboxes on other frames

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    7

    resolved [RESOLVED] How do I put User Submitted input text into dynamic textboxes on other frames

    I have an input text box with the instance inputnameone. On another page I have a dynamic text box with the instance outputnameone. When I press button with the instance "submit", I want the information in inputnameone to go into output name one. From the basic as3 I've been able to learn I've written this actionscript:

    submit.addEventListener(MouseEvent.MOUSE_DOWN, transfernameone);
    function transfernameone(e:MouseEvent):void {
    outputnameone.text = inputnameone.text;
    }

    This works fine if the output box is on the same frame as the input box, but not if the output box is on a later occurring frame. If it is on a later occurring frame, I get this error:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at filename_fla::MainTimeline/transfernameone()

    How can I fix this?

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    Store the text of your input field in some variable on the first frame, and when you switch to the next frame assign this variable's value to the text field's text property.
    Something like:
    Actionscript Code:
    var inputText:String;
    submit.addEventListener(MouseEvent.MOUSE_DOWN, transfernameone);
    function transfernameone(e:MouseEvent):void {
              inputText = inputnameone.text;
    }

    When you switch to the next frame, do this:
    Actionscript Code:
    secondFrameTextField.text = inputText;

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    7
    That worked perfectly! Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center