tags:

views:

122

answers:

1

Hello,

I am programming an aplication with Adobe Flex, but because i just begining with this language a couple of days ago i have a lot of doubts. I have created two states and a transition between them, now my goal is to programatically switch over and over again between these two states every 5 seconds.

I aproach this using timer object and it works fine, but my question is: Is there is any other elegant method to do that? and Could be intensive from the resources point of view the use of these timers in flex?

thanks

+1  A: 

Hi, if you need to switch between states every whatever interval of time, then Timer is the best choice. There are setInterval/setTimeout methods, but they are the same timers. Anyway, Timer is not the Flex thing, it's inside flash core(located in flash.utils package).

From the resources point of view, Timer itself is not a problem. Just make sure that you don't execute modelling of atomic explosion every one second (I mean don't use heavy methods as listeners to timer event).

Sergey Z.