8 Replies Latest reply on Nov 16, 2009 7:15 PM by zeroskillz

    need help for a school project

    macklester1988

      im trying to create a program for school in flash, its a blood alcohol level calculator, i have a formula that does the calculations but am having trouble trying to put it in the program code. any help would be great thankyou

        • 1. Re: need help for a school project
          Ned Murphy Adobe Community Professional & MVP

          What trouble are you having?  What have you tried?  What calculation do you need to code?

          • 2. Re: need help for a school project
            macklester1988 Level 1

            the main trouble we are having is figuring out how to put our formula into the program to make it work with what the user would input

             

            here:


            Our application would take input from the user at each slide, and input that information into our BAC equation.


            we need to use this formula in the code
            formula:
            (100/weight)(# x .04) - .01(time/40) = BAC
            *where # = number of drinks consumed

            our professor seems to teach us either useless information pertaining to what we need to know,  we keep trying to sit down with him to get him to explain to us in more detail, im not on here looking for someone to do the work for me btw  i wanna learn this stuff i just need someone to point me in the right direction.
            we havent tried much, its not that what we try is unseuccessful its just that we dont know what to try, we are very new like i said

            • 3. Re: need help for a school project
              Ned Murphy Adobe Community Professional & MVP

              I can't read what you put there, so I have to enlarge the text here....

              (100/weight)(# x .04) - .01(time/40) = BAC
              *where # = number of drinks consumed
              That is a simple equation, so what is the problem you are having?    If you want to know the BAC, then you assign the values of weight, number of drinks, and time and process the equation. 
              In Flash, as in most any other language, division is performed by using "/" (forward slash), multiplication is performed using "*" (asterisk), and subtraction is performed using "-" (dash).  Below, I use a different variable name in place of "#" since that is not a valid variable name.
              BAC = (100/weight)*(numDrinks x .04) - .01*(time/40);
              • 4. Re: need help for a school project
                macklester1988 Level 1

                yes thankyou for replying, we know how the formula works, are issue is how to make it work with the code, we are new to flash, we know how to make the windows, boxes, and buttons for the user to interact with and iput their information but our problem is how do we make the program take that information and put it in the formula and caluculate the BAC itself and then show the user.

                • 5. Re: need help for a school project
                  Ned Murphy Adobe Community Professional & MVP

                  The equation I showed you is ready to be calculated as Flash code (one error, the "x" should be a "*"), you just need to define the values for the variables I used.  I have no idea how you have that information implemented, so I can't offer much beyond that.  If you have user inputs, such as textfields, then you can use those inputs directly via converting them to Number values.  Rather than me inventing a scenario to try to show you, describe the scenario you already have, including the details of what defines your data values (instances names of textfields, buttons involved, etc).

                  • 6. Re: need help for a school project
                    John Hall Level 4

                    Let's take a step back. Do you do any programming already? In Flash or other computer language? To do what you want to do is going to require writing some scripts that implement the formula you have. To do that, we need to know where you're at with programming in Flash or in general to use the best vocabulary to explain the issues.

                     

                    BTW, is time in your equation in minutes?

                    • 7. Re: need help for a school project
                      macklester1988 Level 1

                      well we know very little in flash, i know html, and some processing, this class is supposed to be an introduction to processing and flash and yet we are expected to do much more than we can from what we are taught, which i why im turning to forums and the internet to learn. this needs to be in flash and in flash we know the basics such as layers, making shapes, texts, and a little bit with animation and time frames.

                      • 8. Re: need help for a school project
                        zeroskillz Level 3

                        // set these with text inputs, and run the calculation as a result of clicking a button...

                         

                        var weight:Number = 180;

                        var time:Number = 60;

                        var drinks:Number = 10;

                         

                        var BAC = (100/weight)*(drinks * .04) - .01*(time/40);

                         

                        trace(BAC);

                         

                         

                         

                        assuming that the bits in red below are correct

                         

                         

                        (100/weight)* (# * .04) - .01* (time/40) = BAC
                        HTH,
                        -Ted