Alright, second update.
*Note: These files are given for instructional purposes; don't ruin it for everyone else by claiming it as your own! I'll stop providing them if you do.
**Note: These files are in the Black-and-Green Terminal Style because I don't want anyone ripping my hard work from the .fla files. They are just examples; I have everything in the given files done with the Vista style, I just took the code and applied it to a generic MC.
FILE: .FLA | .SWF
As you can see, you can have multiple windows open, and if you click the X button, they shrink and fade out, like Vista. Trust me, it looks really cool with the styles applied.
Tutorial
If you'd like to make a realistic Vista spoof, you're going to need some windows that fade in and out, as well as the feature to have multiple programs of the same type open. Here's how:
First, create your window, as well as an X button. The X button should be a MovieClip, rather than a button. It has three frames, one for the "UP, OVER, and DOWN" frames that would normally be in a button. The first frame has the code "stop();" in the actions panel, and the rest are empty. They should be set up like this:
_root
^ ^
window_mc
^ ^
XBUTTON_btn
First-time explaination of chart: First is the _root layer, the main layer in Flash. The movieclip on the stage, "window_mc" is centered on the stage. Inside of "window_mc" is a movieclip with the name "XBUTTON_btn".
Now, go to your library and right-click on "window_mc". Choose "Linkage..." and then check "Export For Actionscript". In the "Identifier" field, enter "window_mc" if it isn't already there.
Now that that's done, create a desktop icon and place it in the top-left corner of your stage. Make sure it's a button.
Give it this code (explained later):
on(release){
if(_root.numWindows <= 0){
_root.attachMovie("window_mc", "window"+_root.numWindows, _root.numWindows);
_root["window"+_root.numWindows]._x=550/2+(_root.numWindows*3)
_root["window"+_root.numWindows]._y=400/2+(_root.numWindows*3)
_root.numWindows++;
}else if(_root.numWindows>0){
_root.window0.duplicateMovieClip("window"+_root.numWindows, _root.numWindows);
_root["window"+_root.numWindows]._x=550/2+(_root.numWindows*4)
_root["window"+_root.numWindows]._y=400/2+(_root.numWindows*4)
_root.numWindows++;
}else{
trace("there's a problem...");
}
}
Basically what this does, is when you click the button, it calls on the "window_mc" from the library. It creates an instance on the stage with its own unique instance name, and if there is more than one, it bevels its location. Now, test the movie. Your window should appear, and you can also create more than one!
But there's one problem--you can't close it. Don't worry, we'll fix that soon enough...
Now, go into your "window_mc" clip, and click on your x button (it should be a MovieClip, NOT a button).
Give it this code:
onClipEvent(load){
this._parent._alpha = 100;
this._parent._xscale = 100;
this._parent._yscale = 100;
alphaMin = 0;
XSCALE = 0;
YSCALE = 0;
}
onClipEvent(enterFrame){
//Specs for Removal
if(this._parent._alpha<0){
_root.numWindows--;
this._parent.removeMovieClip();
}
//Exit Stats
this._parent._alpha-= alphaMin;
this._parent._xscale-= XSCALE;
this._parent._yscale-= YSCALE;
//Buttons
this.onRollOver = function(){
this.gotoAndStop(2);
}
this.rollOut = function(){
this.gotoAndStop(1);
}
this.onRelease = function(){
this.gotoAndStop(1);
//Fade/resize
alphaMin = 35
XSCALE = YSCALE = 5
//Rest
}
}
It may not be the most efficient code, but it works. I'll refine it (again) later.
All this does is set three variables--alphaMin, XSCALE, and YSCALE--and applies them to the "window_mc" clip every time the movie enters a frame. It also sets the button so it acts like a button, because for some reason I couldn't get a real button to work.
Now, when you test your movie, it should be almost identical to the .FLA file I posted. If you have any problems, please PM me.