Professional Web Applications Themes

percentages in mx - Macromedia Director Basics

im using director mx at college and part of my course requires a percentage to be calculated from the value of two variables however, the script im using doesn't appear to work as im getting silly values. i've already set the float precision if you think that's what it is... heres an example of the code i'm using gPercentage = ("gCorrect/gOverall") * 100 any help to remedy the problem woyuld be much appreciated.... moggie...

  1. #1

    Default percentages in mx

    im using director mx at college and part of my course requires a percentage to be calculated from the value of two variables however, the script im using doesn't appear to work as im getting silly values.
    i've already set the float precision if you think that's what it is...

    heres an example of the code i'm using



    gPercentage = ("gCorrect/gOverall") * 100


    any help to remedy the problem woyuld be much appreciated....



    moggie


    Moggie webforumsuser@macromedia.com Guest

  2. #2

    Default Re: percentages in mx

    not sure what value you're using, but you probably want to force it to
    calculate with floating point values and also drop the quotes

    gPercentage = (float(gCorrect)/float(gOverall)) * 100

    give that a try,

    regards,

    richie

    On Tue, 13 Jan 2004 11:50:57 +0000 (UTC), "Moggie"
    [email]webforumsusermacromedia.com[/email] wrote:
    >im using director mx at college and part of my course requires a percentage to be calculated from the value of two variables however, the script im using doesn't appear to work as im getting silly values.
    >i've already set the float precision if you think that's what it is...
    >
    >heres an example of the code i'm using
    >
    >
    >
    > gPercentage = ("gCorrect/gOverall") * 100
    >
    >
    >any help to remedy the problem woyuld be much appreciated....
    >
    >
    >
    >moggie
    >
    Richie Bisset Guest

  3. #3

    Default Re: percentages in mx

    You cannot multiply a string by a number...

    gPercentage = (gCorrect / gOverall) * 100

    and you might want to use floats as well:

    gPercentage = (float(gCorrect) / gOverall) * 100

    PS - only one number needs to be a float for the entire operation to be
    float...

    --


    Dave
    [url]http://www.blurredistinction.com/director[/url]


    Dave Mennenoh Guest

Similar Threads

  1. Calculate Ink Percentages in Acrobat Professional
    By tim_zurko@adobeforums.com in forum Adobe Acrobat Macintosh
    Replies: 2
    Last Post: November 6th, 02:35 AM
  2. Specifying Width and Height properties as percentages
    By Nathan Sokalski in forum ASP.NET Building Controls
    Replies: 2
    Last Post: June 15th, 03:36 AM
  3. onstat -P buffer percentages
    By Glen Johnson in forum Informix
    Replies: 3
    Last Post: November 17th, 01:25 PM
  4. Percentages
    By Gianna in forum Microsoft Access
    Replies: 1
    Last Post: July 1st, 08:12 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139