Skip navigation
Currently Being Moderated

For Loop Problem

Feb 18, 2013 5:37 AM

Hey guys can you please help me out cause i dont know whats wrong(btw im a Flex noob)

 

Is it possible to have 2 variable conditions in a loop like the following

 

 

 

for (var i:int = 1; j<100 ; i++)

                                        {

 

                                                  PartProduced = Sertime1*i

                                                  j= 100*(ArrivalParts/PartProduced)

 

                                        }

 

 

 

Servtime and arrival parts are declared before as 14 and 100

 

The loop is suppose to stop when i=8 since j will be 89 and hence exit the loop,but it is not doing so and stops when i=2

 

Please Help me and thanks for your help

 
Replies
  • Currently Being Moderated
    Feb 18, 2013 6:01 AM   in reply to Gug88

    Maybe you should do a while instead of a for loop.

     

    Something like this:

     

    <declarations>

         <fx:Number id="Servtime">100</fx:Number>

         <fx:Number id="ArrivalParts">18</fx:Number>

        <fx:Number id="Part Produced">0</fx:Number>

    </declarations>

     

    <fx:Script>

      <![CDATA[

    private yourFunction ():void{

         var j:int = 0;

         var i:int = 1;

     

         while (j < 100) {

              Part Produced = Servtime *  i;

              j = 100 (ArrivalParts / PartProduced);

              i++;

         }

    }

    ]]>

    </fx:Script>

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points