POP UP WINDOWS coding

VIEW EXAMPLE 

INFO:  
This is a short info how the coding  for windows on this site was made. 
Innitilay I made the popup windows coding (create/destroy/drag/bring-to-front windows functions) in 
Flash 4. All is pretty simple, only the bring-to-front function was a tricky one. There is no way to 
change movie clip z-order in Flash 4. So everything was done using  Remove Movie Clip, then 
recreating it with Duplicate Movie Clip (with a higher Level parameter).  
But, inspired by the code offered by Nathan Dicken (nathand@boxerjiam.com), where he uses the new 
Flash 5 function SwapDepths ,  I switched to Flash 5 ActionScript. I re-coded the windows functions, 
and added step by step more functionality.  
The most interesting part was to make the windows  change the Z-order by clicking on ANY area of 
the window (just like in a OS interface like Windows). Making the whole window a button isn't a good 
decision. So I made it another way - using a movie clip that follows to the position of the last mouse 
click, and a hitTest function to detect wich window receives the mouse click (the top one).
I also was thinking on how to remove a bug that is present on many site that uses windows interface. 
The buttons on the windows under the top window do react on clicks. So You can drag or close a 
window, or click a link on it, even if the window it's not on the top. If windows are not semitrasperent - user even don't understand what he clicked. And if windows are semitrasparent it looks weird anyway. 
A good decision was to disable all the buttons on the windows that are not on the top... It involves a lot of coding that tracks every window Z-order and also a new problem - disabling all the buttons in the 
content of the window, wich is supposed to be a Movie Clip loaded from an external file.  Also we 
have to disable all the buttons on the site that comes under the window, in the case we allow the 
window to be dragged in such areas. So I made it the easiest way - covered the entire window area with 
an dynamic textbox with selection disabled. That way the clicks on window's area are received by this 
text box, not going trhough window.  The only bad aspect of it -  it's a changed cursor. But it requires 
no coding at all. 
Then I added the loading content from an external file function (with a Flash 5 preloader). That way the 
content loads just when it is needed.
The function that creates a window object  receives just 1 parameter - the file name of the content file. 
Then the window  launches its preloader and loads the data from the file. 
And the site is organizing the way, that adding a new section is pretty simple. Make the content Movie 
Clip in an external file (using a template, to fit the window size) and add a link to the main movie  with the file name. That's all.
