I’m wondering what’s best practice of creating sequence of events… If, for example, I wanna do 5 things in order, how to accomplish that?
I could make something like:
// do 1
addEventListener(1.COMPLETE, do2)
// do 2
addEventListener(2.COMPLETE, do3)
......
it’s not actual code, just basic idea (:
But, I’d like something more efficient. I’m thinking about:
public var inProgress:Boolean = false;
public var counter:int = 1;
addEventListener(Event.'GLOBAL_EVENT', doWhatYouWant)
private function doWhatYouWant():void {
if (!inProgress) {
counter++:
// do my_thing_no.'counter'
}
}
//my_thing_no.1
*start
inProgress = true;
*do some things
*end
inProgress = false;
// finish my_thing_no.1
So I want to do my_thing_no.1, when I start I’ll set global variable inProgress to true, and back to false when I finish doing my_thing_no.1… Also, I want to listen for some GLOBAL_EVENT and when it happens, I wanna check if my application is doing something with inProgress variable, if it does- skip, if not- go do next thing in sequence…
Now, my actual questions: what GLOBAL_EVENT should I use? Assuming this is good idea for sequence (: If not, I’m open to suggestions… I’m thinking about Event.ENTER_FRAME, but I’m not sure how’s that gonna affect other things, because of the frame rate… Is there some event that is dispatched when anything happens in application? Is that what Event.CHANGE do? Documentation for Event class constants is really poor:
Event.CHANGE - *Defines the value of the type property of a change event object.
*Really??!?
If you know of any resources that explain what all those Event.'CONSTANT’s do please post link…
I hope you’ll understand what I’m talking about (: I’m sorry I can’t be more specific, since this is just a basic concept, not it’s application.
Sasxa