Results 1 to 2 of 2

Thread: input?

  1. #1
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default input?

    Can't get this to work. Don't know why I think i have to declare something I forgot about. I have a text field type input text with an instance name inputData. I have a submit button called submit. This is the action script associated with is:
    Code:
    var test:String='Your Name is' + inputData.text + 'Right?';
    if (all.selected==true) {
    submit.onRelease=function() {
    trace(test);
    }
    }
    The trace brings back a result of Your Name isRight?. Completely ignoring any input put in. It does the same thing if nothing is put in and the submit is hit. Any help you have is appreciated. Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Your code is right, but your logic is a little off. I'm assuming your logic, so please forgive me if I'm wrong. But, from the code I can glean that you're thinking that when you click the submit button, Flash will dynamically generate the value of test. In fact, that's not how it works.

    When you declare var test:String='Your Name is' + inputData.text + 'Right?'; at the onset of your Flash application, that variable is being set at that moment. Since, when you trace() out the value, it's blank...I'm assuming that the input field is black at the point of this call. Thus, your results.

    To fix this, you can declare the variable inside of the submit onRelease function.

    Code:
    if (all.selected == true) {
    	submit.onRelease=function() {
    		var test:String = "Your Name is" + inputData.text + "Right?";
    		trace(test);
    	}
    }

Bookmarks

Posting Permissions

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