A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Text field question

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    4

    Text field question

    Hey guys,

    I'm in the final stages of making a flash website for my design course and I'm having a bit of trouble with the last bit of my coding. hopefully someone can help

    I'm using as2 and I'm trying to make movie clips appear when a certain value is shown on a text field I'm using.

    Basically I would like a movie clip to be _visible if the value of the text field is between 0-10, or 11-20. What I have so far is something like this...

    if(field_txt.Number == 50){
    movie clip._visible = true;
    }

    the problem is the only way that works is if the text field shows 50 exactly. Is there a way to specify that it looks for any number between 50-60...

    Hopefully I explained this well enough (still learned flash lingo as I go)

    Thanks in advance!

  2. #2
    Junior Member
    Join Date
    Jun 2013
    Posts
    4
    *small update.

    Some progress has been made. I have given my textfield the variable name "score" so my code will look a bit different.

    First I found out about using >= instead of just =

    so my first attempt looked like this:

    if(score >= 50){
    movie clip._visible = true;
    }

    This works is the sense that if the number shown in the text field is above 50 it will show the clip, but I have a series of clips that I want to show depending on what the text field numbers add to. Also the movie clip shows with any number that is over 50, my goal is for it to show only for numbers between 50 and 60.

    Next I tried:

    if(score >= 50){
    movieclip._visible = true;
    }
    else if(score >=60){
    movieclip._visible = false;
    }

    Same problem, it shows the movie clip when the number is over 50 but nothing happens over 60. The movieclip will disappear when the score changes to anything less than 50 which is a solid breakthrough.The script contradicted itself I think because the script constantly checked the first if statement and didn't follow the second.

    Lastly I tried this:

    if(score >= 50, score <= 60){
    facegood1._visible = true;
    }

    I was hoping this had it but still the same result as above...

    Anyone have any ideas?
    Last edited by kcoo; 06-09-2013 at 01:59 AM.

  3. #3
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    This might help you work it out
    PHP Code:
    if (score >= 50 && score <= 60

  4. #4
    Junior Member
    Join Date
    Jun 2013
    Posts
    4
    Quote Originally Posted by fruitbeard View Post
    Hi,

    This might help you work it out
    PHP Code:
    if (score >= 50 && score <= 60
    Success! thank you so much!

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