need some help
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: need some help

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    1

    need some help

    so i got an assignment where i have to change it to find the total of the last array instead of what its doing now and finding the average


    this is the array
    Code:
    passengerData[0] = ["Homer", "Simpson", 330, 1700, 1500, 220];
    passengerData[1] = ["Marge", "Simpson", 750, 1700, 1500, 800];


    and this is the function
    Code:
    function onTotalpoints(event: MouseEvent): void 
            {
                var var2:* = 0;
                var var3:* = 0;
                var var4:* = NaN;
                var var5:* = NaN;
                var var6:* = 0;
                var var7:* = 0;
                var var8:* = 0;
                var2 = -1;
                var3 = -1;
                var4 = 0;
                var5 = 0;
                var6 = 0;
                var7 = 0;      
                while (var7 < passengerData.length)
                {
                    
                    var2 = passengerData[var7][0].indexOf(first_txt.text);
                    var3 = passengerData[var7][1].indexOf(second_txt.text);
                    if (var2 != -1 && var3 != -1)
                    {
                        var8 = 2;
                        while (var8 < passengerData[0].length)
                        {
                            var4 = passengerData[var7][var8];
                          var6++;
                          var8++;
                        }
                        var5 = var4 / var6;
                        listing = passengerData[var7][0] + "\'s Average is: " + var5;
                        message_txt.text = listing;
                    }
                    var7++;
                }
                return;
            } // end function
    help would be much appreciated

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    969
    Hi,

    I smell decompiled code, why not attach your file and ask again.

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

Poll by Flashkit.com