Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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 Nov 11 '11 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 Nov 11 '11 at 16:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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