# How to create sequence?

**URL:** <https://forum.kirupa.com/t/how-to-create-sequence/228324>\
**Category:** Uncategorized\
**Created:** [June 6, 2007, 10:29pm UTC](https://forum.kirupa.com/t/how-to-create-sequence/228324 "2007-06-06T22:29:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasxa](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sasxa](https://forum.kirupa.com/u/sasxa)\
**Post date:** [June 6, 2007, 10:29pm UTC](https://forum.kirupa.com/t/how-to-create-sequence/228324/1 "2007-06-06T22:29:32Z")

</div>

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:

```auto

// 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:

```auto

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
