A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How can I add a Number to a string? Like as in 2+1=3 not as in 2+1=21

  1. #1
    Member
    Join Date
    Jun 2001
    Posts
    95
    How can I add a Number to a string? Like as in 2+1=3 not as in 2+1=21

    I am making it so that after someone crosses a frame each time it adds a number and when it gets to 8 it does some other action. Would it be something like this? 'tracksplayed= +1;' Thanx in advance.

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    433
    You need to convert the string into a number by using
    number = parseInt(myString) + 10
    for example.
    To increment a variable, you can use one of these:
    variable++
    variable += 1 (or any number, in fact)
    variable = variable + 1

    Hope this helps!..
    Arctic

  3. #3
    Member
    Join Date
    Jun 2001
    Posts
    95
    The variable would be in my case "tracksplayed" right?

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