Using the flex viewer 2.4 and Flex 4.5 SDK. I have a bunch of map graphics stored in a map layer. Initially, each graphic is set to visible = false. At the click of a button, I want to loop over each graphic, set it to visible = true, wait three seconds, then onto the next graphic and do the same.

Problem: the graphics don't become visible in the loop - they become visible all at once after the button click event handler has returned.

I've tried doing a refresh() on the graphics and the graphic layer in the loop, but that does not help.

Any ideas?


1 Answer 1


The problem is that flash does not really have a different Thread for the UI. SO when you are running the code, the UI does not draw.

A work around would be to have a timer, and on the timer event, iterate to the next graphics and make it visible.

  • Ok, I will give that a try. Is there a way to send a token object to the timer, similar to what you can do with a HTTPService call?
    – rgwozdz
    Commented Nov 11, 2011 at 15:16
  • Yup, I used the timer. I had to extend the Timer class so I could pass a data object (the graphic to be made visible) to the listener function. Thanks.
    – rgwozdz
    Commented Nov 11, 2011 at 16:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.