dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: calculator help

  1. #1
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899

    calculator help

    Howdy,

    I'm working on a calculator. Pretty simple one. I have it where it inputs the numbers in, but I'm having some trouble with the square root of a number. I'm not too sure how to calculate it. I've done the ^2 and ^3 which were pretty easy. Any help would be greatly appreciated

  2. #2
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    I'm not sure if i exactly got what you are asking...
    if you want to know how to get the square root in flash, then look into the math class

    Math.sqrt
    Math.pow

    ex:

    trace(Math.sqrt(9))
    Last edited by ozmic66; 01-10-2006 at 12:25 PM.

  3. #3
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Yes, thats exactly what I was looking. I didn't think the Math command would have the square root function. Thanks for the help.

  4. #4
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Okay, I got a question about: adding, subtracting, multiplying and dividing the numbers in the calculator. I'm not sure if I should use a variable to store the previous data or how to go about doing this. Thanks again guys and gals.

  5. #5
    Flash programmer
    Join Date
    Jul 2005
    Location
    Sweden
    Posts
    48
    I did something like this in Visual Basic. Simply store the old variable and the operator and use a switch(operator) to decide what operator it is and calculate it. And for the square root: another way to do it is x^1/2, or for the thirdroot (dont know if this is the real name in English) x^1/3.

  6. #6
    Hey Timmy!!! walsher's Avatar
    Join Date
    Jan 2005
    Location
    Latrobe, PA
    Posts
    1,899
    Oh,okay I see what your say'n. Thanks for the help

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