1 Reply Latest reply on Aug 7, 2006 6:59 PM by ntsiii

    triggering event from for-each

    WV777
      Hi,

      I have a process that takes long to execute, I want to be able to send a progress notification to the user with the hope of not getting him bored or impatient, for some reason I can't achieve it and I don't know where to go for help, if you know how to solve this, any help will be greatly appreciated.

      I have some code like this:

      <code in mxml for my application>
      - component declared .. onXEvent="showProgress()"
      - script for showProgress calls refresh for ProgressBar Component
      </code in mxml for my application>
      . . .

      <code for my component>
      .
      .
      for each (var myObject:xObject in MyCollectionOfMyObjects)
      {
      // do some complex logic and calls methods for this item
      // creates and triggers event for progress notification
      }
      </code for my component>

      I would expect to see my ProgressBar advancing as the process is completed, but for some reason the process seems to take control of the execution and no onProgressEvent is fired until the foreach finishes execution. It will run perfectly in the debugger (step by step) but it doesn't work at runtime.

      Is there any way I can achieve this in Flex?? Is there any event class I can use to solve this issue?
      maybe anyone has done this before or knows a link to more information on this subject?


      Thanks in advance

      William Vega
      MCSD / Beginner Flex Developer