Copy link to clipboard
Copied
Hi There,
I'm new to working with Flash Builder and have what I think is an easy question.
I work for a not-for-profit radio station and am creating an application that displays the personality that's on-air. For example, Mon-Fri from 6a-10a I'd like it to show the morning show state, etc... But on weekends show something generic. I already have an XML data service that's working and displaying artist & title info... But for the life of me can't figure out how to change states by time. I've googled and can only find state changes by button clicks, which I already knew. Any help MUCH appreciated - thanks!
Copy link to clipboard
Copied
Hi Izzy_Knight,
It depends on the time you would like this to happen. The easiest way would be to create a creationComplete event handler for the application (or the component you are creating) and then check the current time (using the Date class). On your desired times, change the state with setCurrentState() accordingly.
If you would like this to happen overtime, as-it-runs, then my suggestion would be to create a Timer object with 60000 milliseconds for example and make the same if statements there as well (you could also call, from inside your timer event handler, the initially called creationComplete handler with null as an input event).
Hope this makes sense.
Ioannis
Copy link to clipboard
Copied
Ioannis-bels,
I'll be sure to give this a shot and let you know if this works. Thanks!
Copy link to clipboard
Copied
You could use a Timer and TimerEvent.
[http://livedocs.adobe.com/flex/3/langref/flash/utils/Timer.html] and [http://livedocs.adobe.com/flex/3/langref/flash/events/TimerEvent.html]
var myTimer:Timer=new Timer(delay,repeatCount)
myTimer.addEventListener(TimerEvent.TIMER,functionThatWillChangeStates)
Hope this helps,
Balakrishnan V