views:

243

answers:

1

Hi folks!!

Driven on by curiosity, I’m trying to understand the Life Cycle used by Flex Application.

So, I’ve done a little research on this argument; the two key concepts used into the FlashPlayer are:

  • SWF Frame: it’s the logical unit that contains graphical code and as code
  • Flash Player Frame: it’s the time interval used by Flash runtime to update the screen and defined by frameRate property

If so, could you explain me the relationship bewteen these two concepts? In particular, are they paired togheter or not?

The main rule is: the Flash Player streams in a swf; until a full SWF Frame is read, the Flash Player cannot render it.

I’ll try to explain what I need to understand. For the sake of simplicity, suppose you have a two frame application: SWF FR 1 and SWF FR 2.

In general (for example in CS4) a frame is considered as a logical unit (delimited by ShowFrame tag) where you can attach as3 code. This as a simplified version of a swf file, i think:

  • Header // frameRate is defined here
  • Symbols, classes etc… // this is FR1 === ShowFrame ===
  • Symbols, classes etc… // this is FR2 === ShowFrame === End

If you have two frame, FR1 and FR2, Flash starts executing FR1 and goes to the next one (FR2). If you don’t stop the excution, the Player executes and renderes code contained into FR1 and FR2 through an infinite loop. On the contrary, when you stop the execution, for example in FR2, the flash player loops executing code contained in FR2.

So, can Flash Player Frames took place many times per SWF Frame?

When FR1 is downloading (FR1 is not fully loaded) is there any enterFrame events or not? Does the first frameEvent take place when the FR1 is fully loaded? During what period of time is FR1 rendered? An other scenario, if you have called the stop command into FR1, you will get enterFrame at the rate you specify (the current frame is FR1). Meanwhile FR2 is downloading. When it’s finished, you go to the next frame (FR2). During what period of time is FR2 rendered? Does Flash Player try to render FR2 to its next time interval?

Take in account this simple sequence:

  1. FR1 is downloading
  2. FR1 is fully downloaded
  3. FR1 calls stop() method, meanwhile FR2 is downloading
  4. FR2 is fully downloaded
  5. Go to FR2
  6. FR2 calls stop() method
  7. And so on

Could you underscore for me when Flash Player enterFrame events take place?

Thank you for your time. Best regards, Flex_Addicted.

A: 

Though it looks like you have definitely been looking into things, some of your assumptions are incorrect. Flex is Flash code written up into one pretty framework. So everything comes down to frames which are a mixture of code executing and the results of that code executing, rendering. When all the required code has executed and the rendering process is complete, the frame is complete and the flash player moves on to the next frame.

So then your enterFrame is called.

Now it isn't typical as a Flex developer to be listening for the enterFrame event.

To understand Flex Apps, you just need to think that they are Flash apps, with the first frame being a loading frame, and the second being the app. It is the subparts and their individual timelines that make up all the rest of the frames. This concept definitely confuses people because then they believe that the enterFrame should only be called twice, this isn't the case.

The next wrong assumption many people has is that just because "no code is executing" that the frames aren't still being called. This also isn't the case. Just because something isn't changing doesn't mean that frames aren't being called and - without the appropriate checks - large amounts of processing aren't happening.

HTH

jonbcampos
Thank you for the reply jonbcampos!!! Could you explain in more detail these concepts? What do you mean with frame? I'm really interested and I would understand this mechanism which you've described. Thank you again. Best Regards and Happy New Year
Flex_Addicted
If you've looked at Flash dev environment a frame is a single point on the timeline. In the end everything is just one big movie.
jonbcampos