Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks.

share|improve this question

1 Answer 1

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

 
discard

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.