BACKGROUND (note: seting frameStrata to BACKGROUND will also block your frame from reciving mouse events until you set FrameLevel to 1 or more)

Notes:

if two frames have same frameStrata values one loaded earlier will be abowe one loaded later (that is why all orginal ui things are higher than similar level addon ones)

toplevel

what it is:same as frameStrata it is atribute, this one is kinda unknow purpose yet but it seem to affect frame graphic effects.

use:toplevel="true" or "false" (default)

Notes:

If 2 or more frames with same frameStrata values have toplevel set as true then normal rules will apply (ie one loaded earlier is above)

toplevel seem to work only on art (graphical effects) it doesnt affect things as OnEnter event (ie if lower frame is loaded earlier it still will recive OnEnter event, not the higher frame with toplevel value set on true)

FrameLevel(Corrections thanks to Mondinga)

what it is:It seem to be internal frame variable which is responsible for proper layering frames with same frameStrata value

use: to read FrameLevel: this:GetFrameLevel() to set FrameLevel SetFrameLevel(number)

Notes:

Frames start with FrameLevel = parent FrameLevel+1 (if parent is set) or 0 (if there is no parent)

FrameLevel will never bring your frame above higher frameStrata frame

FrameLevel affects mouse events (not like toplevel)

Important FrameLevel = 1 is enough to bring your frame above frame with same frameStrata and toplevel="true"

This info is based on my experiments and it may be wrong (although it shouldnt) if i made mistake somewhere please corect me

also if you have anything to add based on your personal expirience please do it

Toplevel doesn't have anything to do with frame level. Before beta ended slouken posted saying that toplevel="true" simply means the frame is something flagged for user interaction, most likely with the mouse. What actual impacts it has I'm unsure of, as the answer was fairly vague. At any rate, this means most default UI components are set to toplevel. A few things are not though, such as the durability frame.

And a frame's level within it's strata is not always set to 0 - it is determined first by it's XML nesting. For instance, take the player health bar in the player frame. PlayerFrameHealthBar:GetFrameLevel() returns 3. If you look, it is a direct child of the PlayerFrame itself, even if PlayerFrame is not set as it's parent. So, what does PlayerFrame return for a level? PlayerFrame:GetFrameLevel() returns 2, as expected.

But why is it 2, even though it's the lowest level frame in the PlayerFrame.xml file? Because the player frame's parent is set to UIParent, and UIParent:GetFrameLevel() does indeed return 1. And if you look, UIParent's parent is set to WorldFrame, which returns 0 for a frame level.

But this doesn't entirely make sense either, or sense as you'd expect it, if you're considering how frame levels work within different strata. The UIParent is set to MEDIUM strata, the PlayerFrame is set to LOW, and the WorldFrame is set to BACKGROUND, so why would the frame level of one extend above the other, if it's set to a lower strata? Perhaps these levels are simply unimportant to the XML engine, and are something cooked up solely by the LUA engine, without a thought to strata or context at all?

As I've always thought, the :SetFrameLevel() method is a sort of hack-ish way of manually defying the XML. Indeed, if you look through a lot of the default code, Blizz will intentionally embed frames within frames within frames, seemingly without reason, simply to get to the correct frame level they need for them to display. The player frame is a great example, as is the main menu bar.

At any rate, we don't know exactly how it all works, but that doesn't impact heavily being able to use the system. In the end you usually just have to do whatever works to get things to display and operate correctly.

Well im unsure about toplevel but it does seem to affect leyering of frames (at least graphical parts as backdrops and textures...) as for flaging to mouse interaction both my frames had OnEnter events and seting toplevel on one to true actually didn't change a thing... still one that was loaded earlier was geting mouse event...

As for frame levels.. yah my mistake here, i didn't test how it acts with parent thing...

But it makes sense to me. It just do some things for you so you don't have to set it manualy everytime. Default value set as parent FrameLevel+1 (if parent exists) or 0 (if there isnt parent declared) will assure that child frame is above parent frame, and since default frameStrata for frame is same as parent frame it makes sense (So you don't need to set frameLevel and frameStrata for your frames everytime manualy).

As for that it isn't affected by frameStrata... Well i think that it doesn't metter and they knew that and didn't bother to implement more complex code.

It doesn't metter because FrameLevel comes in play mainly when you have many frames in same spot with same frameStrata and you want to sort them.
Other than that it don't affect anything since frame with higher frameStrata will show above frame with lower one even if lower one has FrameLevel set as 100 or more.