A Flash Developer Resource Site

+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    4

    resolved [RESOLVED] subtract number in text field

    I have a text field which has a variable theyear assigned to it. The field starts with 2012 in it.

    I have a button which has this script attached...


    on (release) {
    if (Number(theyear)>2003) {

    oldyear=theyear;
    updatedyear=Number((theyear)-1)
    trace(updatedyear)

    theyear = updatedyear;

    }
    }


    With previous editions of Flash, each button click would reduce the visible value in the text field.

    I am using CS6 now and although the traced variable logs correctly, the display in the text field goes from 2012 to 2011 to 200 and stays that way.

    I'm a novice and am stumped. Any help would be appreciated.

  2. #2
    Senior Member Steven FN's Avatar
    Join Date
    Mar 2010
    Location
    CA, USA
    Posts
    274
    Hi, upload your FLA so members can take a look. Might be settings of the TextField or some other overlooked setting.

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    4

    test file attached

    thank you
    Attached Files

  4. #4
    _____________ fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    401
    Hi,

    Try
    Actionscript Code:
    on (release) {
        if (theyear > 2003)
        {
            theyear--;
            trace(theyear);
        }
    }

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    @fruitbeard: much simpler language. thank you.

    however, the result is the same.

    I'm wondering it's an embedded font issue or some other field restriction I'm unaware of. "2" "0" show up but other individual digits don't.

  6. #6
    Senior Member Steven FN's Avatar
    Join Date
    Mar 2010
    Location
    CA, USA
    Posts
    274
    Ok took a look, and it is a very simple error. You need to embed fonts. When testing things out, i like to set it to Device Fonts so there aren't any problems with text.

  7. #7
    Junior Member
    Join Date
    Aug 2012
    Posts
    4
    Thank you. That was it. I thought I had embedded, but apparently didn't embed everything.

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