First, demand analysis:
1: Full Screen page resolution should be 1024*768 if less than this resolution, the effect of fine screen is not reflected. Therefore, the operating system below this resolution should be restricted from accessing this interface.
2: Open Full-screen window should have the upper right corner to minimize, turn off the button.
3: Each loaded window should be removable, closed, and minimized.
4: The icon on the desktop can be dragged, double-click.
5: The bottom of the screen has a taskbar, when the mouse moved to the bottom of the screen, the taskbar pop-up from the bottom. You can return it to the bottom of the screen with a push button.
Second, technical points:
Java Script:
Screen Object (object):
The object has the following attributes (properties):
availheight [Effective height], (Effective height = height-taskbar height)
availwidth [Effective width],
bufferdepth [buffer size],
colordepth[color depth],
Height [height],
width [breadth],
updateinterval [Update interval],
Window objects (object):
The object has the following attributes (properties):
clientinformation[Client Information], closed [closed],
defaultstatus[default state],
dialogarguments [The Session box returns an array],
Dialogheight [Session frame height], dialogleft [Session box from left screen],
dialogtop[session box from top of screen], dialogwidth[session width]
(The above 5 properties apply only to the Form dialog box created by the person ShowModalDialog ())
document[document],
event[Event],
history[history],
length*[length],
location[position],
name[name],
Navigator[Browser],
offscreenbuffering [Turn off screen buffering y/n],
Opener [Script Open window has opener point to open this window you open your own browser is empty
Window.close According to this judgment whether the prompt]
parent*,[parent Window]
returnvalue[return value],
screen[Screen],
Self[itself],
status[State],
top* [Top window]
*an asterisk indicates properties not applicable to modal dialogs.
The attribute with the * number is not available for modal dialogs (the form session box created by ShowModalDialog ()).
Collections (Collection)
frames* [Framework]
Method (Methods):
alert[warning],
blur[minimized],
clearinterval [Cancel interval],
cleartimeout[purge Timeout setting],
Close[closed],
Confirm [OK] (object.confirm ([message]) are you sure? This function will return a logical value),
execscript[Execute code],
focus[Focus],
moveby[relative movement],
Moveto[moved to],
navigate[navigation =window.location.href Local URL],
open* [Open],
prompt [hint],
Resizeby [Relative scaling],
Resizeto [Zoom to],
scroll[scrolling],
scrollby[relative scrolling],
scrollto[scrolling to],
setinterval[set interval],
settimeout[setting timeout],
showhelp[Show help],
showmodaldialog* [Display form conversation box]
*an asterisk indicates properties not applicable to modal dialogs.
The attribute with the * number is not available for modal dialogs (the form session box created by ShowModalDialog ()).
Event (Events):
onbeforeunload[before closing],
onblur[minimized],
onerror[ERROR],
onfocus[get focus],
onhelp[help],
onload[loading],
onresize[Zoom],
onscroll[scrolling],
onunload [Close]
Flash Action Script:
On (press [presses], release [released], Releaseoutside [externally released],
rollover [sliding], rollOut [sliding away], dragOver [dragged], dragout [towed],
KeyPress "" [Key])
GETURL [Go to Connection] ("JavaScript: Self.close () ");
Stratdrag ("MovieClip"); [Start dragging]
Stopdrag ("MovieClip"); [Stop dragging]
Loadmovie ("*.swf", "MovieClip"); [Load movie to MovieClip]
Loadmovienum ("*.swf", N); [Load movie to Nth level]
Unloadmovie ("*.swf"); [Uninstall movie]
Play () [playback]; Stop () [stop];
Pc_today=new Date (); [New Date Object]
Pc_today.gethours (); When
Pc_today.getminutes (); Part
Pc_today.gettime (); Seconds
. getbytesloaded (); [number of bytes loaded]
. Getbytestotal (); [Total number of bytes to load]
_root.getbytestotal represents the number of bytes in the current SWF file.
On (release) {
GetURL ("JavaScript: Self.close () "); [Go to connection]
}
Execute the JS code, close the current window, the same
GetURL ("JavaScript: Self.blur () ");
You can minimize the current window.
Third, the program code
1, control at 1024*768 resolution above can open Full-screen JS code.
Put this code into the <Body></Body> area.
<script language= "JavaScript" type= "Text/javascript" >
<!--
function Cc_openbrwindow (theurl,winname,features)
{//v2.0
if (screen.width>=1024 && screen.height>=768)
{
window.open (Theurl,winname,features);
}
Else
{
Alert ("Please adjust the resolution to 1024 * 768 for the best display effect." ^_^! ")
}
}
-->
</script>
<a href= "#" ></a>
2,flash test mp3 load percent as:
Description: There is a MovieClip in the main scene for the Loadmp3. The SWF file that is used to load MP3, can also be loaded directly into MP3.
Make a 100-frame loading MovieClip named LOADING_MV.
Do a two-frame image-free movieclip named Loading_mv_test.
The first frame code is as follows:
mp3loaded = _root.loadmp3.getbytesloaded ();
Mp3total = _root.loadmp3.getbytestotal ();
mp3percent = 0;
if (mp3total>1000 && mp3loaded>10) {
When the Loadmp3 in the main scene does not load the movie mp3loaded the value is 1, not 0;
Because there is a byte to represent this MovieClip
mp3percent = Int (mp3loaded/mp3total*100);
_parent.gotoandstop (mp3percent);
} else {
_parent.gotoandstop (1);
}
Pctoday = new Date ();
Pctime = pctoday.gethours () Add ":" Add Pctoday.getminutes () Add: "Add pctoday.getseconds ();
Create a dynamic text object in the scene, the variable name is Pctime, you can display the system time in real time.
The second frame code is as follows:
gotoAndPlay (1);
3, the main code of the desktop icon:
On (Press) {
StartDrag ("");
}
On (release) {
Stopdrag ();
frame = Time._currentframe;
if (settime = = 0) {
SetTime ==0 said it had not started timing. SetTime ==1 says the timer has started.
Time.gotoandplay (1);
SetTime = 1;
}
When opening the settime, set the time position of the record.
if (settime = = 1 && frame<=6) {
Start the timer within 6 frames, (0.5S) release the mouse again.
Loadmovie ("000.jpg", "_root.picback.bak");
You can also change to another action.
} else {
settime = 0; Timing reset.
}
}
Time is a 20-frame MovieClip,
At 20 frames as the Stop ();
Four, the original document
Click to browse the file
********************************
their daily collection and do it for everyone to share!
Part did not have their own exquisite, if wrong, please point out!
Set Home code:
On (release) {
Geturl ("JavaScript:d ocument.body.style.behavior=\ "url (#default #homepage) \";d Ocument.body.sethomepage (\ "http://www.flash8.net
")", "_self");
}
Add to Collection code:
On (release) {
Geturl ("JavaScript: Window.external.addfavorite (\ "http://www.flash8.net\ ")", "_self");
}
A function that determines whether the input is a number:
On (release) {
if (number (pass) ==nan) {//Determine if input is numeric
Pass= "";
}
Check the e-mail function:
function Checkemail (email) {
var str = new String (email);
var arr_email = Str.split ("@");
if ((arr_email.length!= 2) | | | (Arr_email[1].indexof (".") <1)) {
return (false);
} else {
return (true);
}
}
Delay function:
function ShowTime (second, option) {
Delay function
This.createemptymovieclip ("T_MC", 9999);
t = Gettimer ();
F = false;
if ((Gettimer ()-T) > (second*1000)) {
option ();
}
}
function Go () {
Add Effect
jpg2._y = jpg2._y+77;
Jpg2._alpha = jpg2._alpha-15;
}
Fscommand ("fullscreen", "true");
Createemptymovieclip ("Jpg1", 1);
Createemptymovieclip ("Jpg2", 2);
Jpg1.loadmovie ("1.jpg");
Jpg2.loadmovie ("2.jpg");
i = 0;
while (i<=100) {
ShowTime (0.1, go);
i = i+20;
}
A letter in Flash that retains a decimal number
Int (your number *10)/10;
This is to keep a
Multiply by 100 is two bit. Analogy
Flash script Implementation shutdown
FLASH5:
Fscommand ("exec", "Rundll" +CHR (9) + "User.exe,exitwindows");
Mouse Double-click the problem!
Lsn_dbclick = new Object ();
Lsn_key = new Object ();
Lsn_dbclick.onmousedown = function () {
Clicktime = Gettimer ();
if (clicktime-lastclicktime<=300) {
Trace ("Double click Mouse");
}
Lastclicktime = Clicktime;
};
Mouse.addlistener (Lsn_dbclick);
Time = Gettimer ()-down_time;
if (time<300) {
Double-click the Code section
}
Down_time = Gettimer ();
How to get a variable from another SWF
Loadmovienum ("vars.swf", 1["POST"));
_root.onenterframe = function () {
Trace (_LEVEL1.MYVAB);
};
When the load is complete, the output is worth ...
The right mouse button and the scroll wheel code
If Key.isdown (2) {}, (left-key code is 1)
Left: key.istoggled (1)
Right-key: key.istoggled (2)
Wheel: key.istoggled (4)
Wheel 1:key.istoggled (4) PC
Roller 2:key.istoggled (3) Mac machine
Unknown: key.istoggled (3)
This.onenterframe = function () {
if (Key.isdown (2)) {
Trace ("ASDFJSDJKF");
}
}
Implementing the TAB feature
Get focus
Using the Selection.setfocus () function
As an example:
For example, you have n text boxes in the main movie, and the variables are text1,text2 ... You want to make the movie a play, focus on the first
text box you just add as follows in the first frame:
Selection.setfocus ("_root.text1");
We can extrapolate.
Implementing the TAB function two
Make an array of this N text box
Numarray=new Array ("_root.text1", "_root.text2",..................... "_root.textn");
Get Mouse Focus First
X=selection.getfocus (); * x gets a string of mouse focus
for (i=0;i<=n;i++)
{
if (numarray[i]==x) {
Num=i; /* Gets the position of the current focus in the array
}
And then write the TAB key feature
On (keyPress "<TAB>") {
if (num==n) {num=0;}
else{num++;}
Selection.setfocus (Numarray[num]);
}
button to change the selection by using the TAB key like window
With Button.onkillfoucus
* Draw a line between two points
* Draw Spirals
* Draw squares, circles, ellipses
* Parabola
* sine, cosine line
How to use: Add to Frame to
Draw a straight line
/x1, y1: Start coordinates
X2, y2: endpoint coordinates
K is the level
Movieclip.prototype.drawline = function (x1, y1, x2, y2, k) {
This.linestyle (1);
This.moveto (x1, y1);
This.lineto (x2, y2);
};
Draw a line from (0,0) to (100,100)
_root.createemptymovieclip ("MC", 10);
Mc.drawline (0, 0, 100, 100);
Draw a spiral
W, h for width and height
f The length of the control line, expressed in radians
Movieclip.prototype.drawhelix = function (W, h, f) {
for (var i = 0; i<f; i = 0.05) {
This.lineto (X=math.sin (i) *i*w, Y=math.cos (i) *i*h);
This.linestyle (1);
}
};
To draw a helix (100,100) as the center
_root.createemptymovieclip ("Luo", 1);
With (Luo) {
Drawhelix (5, 5, 13);
_x + 100;
_y + 100;
}
,; Multifunctional function, can draw circle, ellipse, positive polygon, etc.
n is the number of sides
Movieclip.prototype.drawmany = function (w, h, N) {
f = 2*math.pi;
for (var i = 0; i<=f/n* (n+1); i + = f/n) {
This.lineto (X=math.sin (i) *w, Y=math.cos (i) *h);
This.linestyle (1);
}
};
Draw a positive Pentagon
_root.createemptymovieclip ("Duobian", 2);
With (Duobian) {
Drawmany (50, 50, 5);
_x + 250;
_y + 100;
5 is the number of sides of the polygon, 6.3 is 2pai
}
Draw an Ellipse
_root.createemptymovieclip ("Tuo", 3);
With (Tuo) {
Drawmany (25, 50, 100);
_x + 400;
_y + 100;
}
Round
_root.createemptymovieclip ("Yuan", 4);
With (Yuan) {
Drawmany (50, 50, 100);
_x + 400;
_y + 300;
}
Parabolic
Movieclip.prototype.drawparabola = function (L, r, K) {
for (var i =-L; i<=r; i = 1) {
This.lineto (X=i, y=k*i*i);
This.linestyle (1);
}
};
Call
_root.createemptymovieclip ("parabola", 100);
With (parabola) {
Drawparabola (50, 50, 0.05);
_x + 200;
_y + 200;
Vertex coordinates
}
Sine line, cosine similar
Movieclip.prototype.drawsin = function (n, k) {
for (var i = 0; i<=90*n; i = 1) {
This.lineto (X=i, Y=k*math.sin (i*math.pi/180));
This.linestyle (1);
}
};
_root.createemptymovieclip ("Sin", 101);
With (sin) {
Drawsin (4, 50);
_x + 200;
_y + 200;
Vertex coordinates
}
Movieclip.prototype.drawwave = function (W, h) {
for (var i = 0; i<=6.3; i = 0.01) {
This.lineto (X=w/math.cos (i), Y=h*math.sin (i)/math.cos (i));
This.linestyle (1);
}
};
_root.createemptymovieclip ("Wave", 105);
With (Wave) {
Drawwave (100, 100);
_x + 200;
_y + 200;
Vertex coordinates
}
A dynamic text sets the Alpha function.
function Setalpha (obj,alpha) {
var rgb= "0x" + (255* (100-alpha)/100). toString (16);
rgb=rgb<<16|rgb<<8|rgb;
Obj.backgroundcolor|=rgb;
Obj.bordercolor|=rgb;
Obj.textcolor|=rgb; }
A function that traverses the instance name of all the MC in the Level0. (Can be modified to use in other areas)
function READALLMC () {
This. Mcitem;
For (what in _level0) {
if (typeof (_level0[what]) = = "MovieClip") {
This. Mcitem[what] = _level0[what];
}
}
}
Set MovieClip color:
MovieClip.prototype.setColor = function (C_color)
{
var mycolor = new Color (this);
Mycolor.setrgb (C_color);
};
Call:
Yourmovieclip.setcolor (0xff0000);
How to set as, reject a movie to be imported with Loadmovie
The following as must be located in the topmost frame action the first row is valid
_root._name = "NN";
This.onenterframe = function () {
if (this._name!= "nn" | | | _root.getdepth ()!=-16384) {
This.unloadmovie ();
}
}; |