MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Complete list of flash common action commands

Source: Shangpin China | Type: website encyclopedia | Time: May 31, 2012
Common action commands of Flash
I Common commands in Flash:
1. Stop playing at the current frame

on(release){
  stop();
}

2. Play from the current frame

on(release){
  play();
}

3. Skip to frame 10 and play from frame 10

on(release){
  gotoAndPlay(10);
}

4. Skip to frame 20 and stop at that frame

on(release){
  gotoAndStop(20);
}

5. Skip to the next scene and continue playing

on(release){
  nextScene();
  play();
}

6. Skip to the previous scene and continue playing

on(release){
  prevScene();
  paly();
}

7. To a specified scene, and start playing

on(release){
GotoAndPlay ("scene name", 1);
}


8. Full screen display of player window

on(release){
  fscommand("fullscreen", true);
}

9. Cancel full screen of player window

on(release){
  fscommand("fullscreen", false);
}

10. The playing picture changes with the size of the player window

on(release){
  fscommand("allowscale", true);
}

11. No matter how large the player window is, the playing image will remain the same size

on(release){
  fscommand("allowscale", false);
}

12. Open a webpage. If the "webpage" and "flash animation" are in the same folder:

on(release){
  getURL(" //ftg.5d6d.com ");
}

13. Open a web page. If the "web page" is in another site on the network:

on(release){
  getURL( //ftg.5d6d.com );

}

14. Jump frame (press button to release jump)
on (release) {
gotoAndPlay(1);

}

15. Play:

on(release){play();}

16. Stop:

on(release){stop();}

17. Skip to the Nth frame and start playing:

on(release){gotoAndplay(N);}

18. Skip to the Nth frame and stop:

on(release){gotoAndstop(N);}

II Common commands about sound in Flash:

1. new Sound()//Create a new sound object;

2. mysound. attachSound()//Load the sound in the library

3. mysound. start()//Play the sound;

4. mysound. getVolume()//Read the volume of the sound

5. mysound. setVolume()//Set the volume

6. mysound. getPan()//Read the sound balance value

7. mysound. setPan()//Set the sound balance value

8. mysound. position//The current position of sound playing

9. mysound.duration//The total length of the sound;

FLASH Action Script Code Collection

1. Simple loading code:
Method 1. Use the number of loaded bytes to judge
b=getBytesTotal();// Get the total number of bytes
a=getBytesLoaded();// Number of bytes downloaded
OnEnterFrame=function() {//Judge when entering the frame
If (a==b) {//If the number of bytes loaded is equal to the total number of bytes
Delete this. onEnterFrame//Delete the entry frame
gotoAndPlay("frame");// Go to the frame you want to play
]Else {//otherwise
a=getBytesLoaded();// Number of bytes downloaded
percent=int(a/b*100)+"%";// Calculate the percentage that has been downloaded
]
}
Put the above method into the first frame

Method 2. Use the loaded frames to judge_
If frame Is loaded. Create a new layer, which is dedicated to Action,
First frame,
IfFrameLoaded ("scene", frame) {//If the frame number in the scene has been loaded
Goto and play()//Skip to and play a certain frame (set by yourself)
}
Frame 2, O* Np@Q
Goto and play ("Scene 1", 1)//Skip to and play the first frame cycle
Add a load MC to play in the middle of the two frames, and it is OK.
2. Use flash to create small pop-up windows
There are two steps:
Add the following actions to the buttons in flash:
on (release) { idd{
getURL ("MM_openBrWindow('newweb.htm','','width=600,height=100')");
In the<head>of the HTML page</ Add the following javascript between head> code.
<script. language="javascript">
<!-- ~ Y
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features); ;
}
//-->
</script>

3. Control of loading swf files
In flash, you can use the loadmovie () and loadmovie () functions to control. The specific code is as follows:
Control of loadmovie loading
_root.createEmptyMovieClip ( "aa" , 1 );
with ( aa ) {
_x = 50 ;
_y = 100 ;
_width=200
_height=300
_alpha=50
loadMovie ( "02.swf" );
}
Loading control of loadMovieNum:
loadMovieNum ( "02.swf" , 1 );
onEnterFrame. = function () {
if ( _level1 ) {
with ( _level1 ) {
_x = 50 ;
_y = 100 ;
}
delete onEnterFrame. ;
}
};
In flash 2004, the MovieClipLoader class was added to control playback. Here is a test code:
var mcl= new MovieClipLoader(); // Define a new MovieClipLoader object ~
var listener = new Object(); // Define a new object to listen to the load process
Listener. onLoadProgress=function (target, loadedBytes, totalBytes) {//called whenever the loaded content is written to the disk during onloadprogress
//Where loadedBytes is the downloaded bytes, and totalBytes is the total bytes of the file being added
x=loadedBytes
y=totalBytes
//Trace (x+"bytes have been loaded");
//Trace (totalBytes+"bytes need load");
D=x * 100/y//Calculate the loaded percentage
)
Listener. onLoadInit=function (target)//Called when the action on the first frame of the loaded clip is executed
{
If (d<100) {//If the loading is not completed, do not play
target.stop();
}Else {//Loading is complete. You can set the number of frames to start playing the loaded swf file
target.gotoAndPlay(2);
}
target._ Width=400//Set the size and position of the loaded movie and other related properties
target._ height=350
target._ x=25
target._ y=50
}
mcl.addListener(listener); // Register a new listener object
Mcl. loadClip ("* * *. swf", 1)//Use the user-defined object to load the swf file

4. Set as Home Page
on (release) {
getURL("void(document.links.style.&#98;ehavior='url(#default#homepage)');voiddocument.links.setHomePage(' //www.flash8.net/ ')","_self", "POST");
}
Note that the ID number of the flash in the web page should be named "links"

Add to Favorites
on (release) {
getURL("void window.external.AddFavorite(' //www.163.com ',' Web page '); ","_self", "POST");
}

5. How to set MC color randomly?
Method 1. The MC instance is named "mc"
mycolor=new Color("mc")
mycolor.setRGB(random(0xffffff))
Method 2. The MC instance is named "mc"
mycolor=new Color("mc") [
mycolor.setRGB(random(16777215))
Method 3. myColor=new Color (mc);
myColorTransform. = new Object();// Use new Object() as
//SetTrandform() creates parameters and takes random values
myra = random(100);
myrb = random(255);
myga = random(100);
mygb = random(255);
myba = random(100);
mybb = random(255);
myaa = random(100);
myab = random(255);
myColorTransform. = {ra:myra, rb:myrb, ga:myga, gb:mygb, ba:myba, bb:mybb, aa:myaa, ab:myab};
myColor.setTransform(myColorTransform);
Method 4. mycolor=new color (mc);
mycolor.setRGB(random(255)<<16|random(255)<<8|random(255));

6. Skills on Random Numbers
Used to generate 5 non repeated random numbers between 6 and 20
1) : First generate a random number and place it at the first position in the array object
2) : Generate a new random number
3) : Check whether the newly generated random number is the same as all the currently generated random numbers. If they are the same, return (2); otherwise, return (4)
4) : Add a new random number to the next array element in the array object
5) : Check whether the number of array objects has reached 5, if it jumps to (6), otherwise it returns (2)
6) : End
AS is as follows:
data1=newArray(5);
tot=1;
data1=[tot-1]=random(20-6+1)+6;
do{
gen_data=random(20-6+1)+6;
reapeat_data=0;
for(i=0,i<=tot-1;i++){
if(gen_data==data
reapeat_data=1;
break;
}
}
if(reapeat_data==0){
tot++
data[tot-1]=reapeat_data;
}
}while(tot<5);
trace(data1);

7. How to disable right-click menu, zoom and full screen
Enter the following command in the first frame:
Full screen ->FS Command ("fullscreen", true)
No zoom ->FS Command ("allowscale", False)
Forbidden menu ->FS Command ("showmenu", False)
The fscommand method is still only applicable to fp, and additional parameters must be added to use it in web pages
<PARAM Name="menu" value="false">
Or use the simplest sentence as, which is applicable to both fp and webpage:
Stage.showMenu=false;

8. How to achieve double click effect?
Put the following code on the button:
on (press) {
time = getTimer()-down_time;
if (time<300) {
trace("ok");
}
down_time = getTimer();
}
In this case, if it is troublesome to use them, write a class to judge
MovieClip.prototype.doubleClick = function() {
this.timer2 = getTimer()/1000;
if ((this.timer2-this.timer)<0.25) {
return true;
} else {
this.timer = getTimer()/1000;
return false;
}
};
Classes that inherit mc can be reused, or can be encapsulated as 2. Class of 0

9. To achieve full screen effect in the browser, just add the following code to the html file:
<script>
window.open("*.swf","","fullscreen=1,menubar=no,width=800,height=600")
</script>
Where *. swf is the FLASH file to be called. Remember to place the file under the same path of the html file. To exit the full screen status, press ALT + F4 or exit.
If you add a close button in the swf file, use the following code:
on(release) {
getURL("opener=null;window.close();");
}

10. How to play the film backwards with AS
function prev(target) {
target.gotoAndStop(target._totalframes);
target.onEnterFrame. = function() { [
if (this._currentframe>1) {
this.gotoAndStop(this._currentframe-1);
} else {
delete this.onEnterFrame;
}
};
}
prev(_root.mc); // Specify the MC instance name to play backwards

11. Sound correlation
Previously linked an attribute for MYSOURCE
1 : mysound=new Sound();// (Note) Mysound is a variable name, and new Sound is a constructor, indicating that mysound is a Sound object.
You can call the Sound method} * HK through mysound in the future[
2: mysound.attachSound("name"); The NAME here is what you wrote in the identifier before, and it will be OK if it corresponds!
3: mysound.setVolume(50); This is to control the sound size when playing the sound. The value is from 0 to 100. Everyone knows the meaning. No one will think that 0 is the loudest~
4:mysound.start(0.01); This statement indicates the start of playing the sound. The parameters in () indicate the start position of the sound. The unit is seconds, followed by several cycles. For example, mysound. start (30, 2)// The sound is cycled twice from 30 seconds.

12. Countdown
First, after creating a new file, use the text tool to create three dynamic text boxes in the main scene. The variable names are leftmin, leftsec, and leftmilli, that is, to display the minutes, seconds, and milliseconds of timing respectively.
Then create a new layer and write the following code on the first frame:
OnLoad=function() {//Execute after the scene is loaded
totalmin = 40;
totalsec = 60;
totalmilli = 100;
//Initialize some variables, which will be used in later calculations
}
nEnterFrame. = Function() {//Execute actions frame by frame“
currentsec = Math.round(getTimer()/1000);
//Find the number of seconds that the current movie has played (rounded)
currentmilli = Math.round(getTimer()/10);
//Find the number of milliseconds that the current movie has played (rounded)
leftsec = totalsec- currentsec;~
//The remaining seconds are equal to the total seconds minus the played seconds
leftmin = totalmin; ^
//The number of starting minutes is equal to the total number of minutes, and the beginning is unchanged
leftmilli = totalmilli - currentmilli;
//The number of milliseconds remaining is equal to the total number of milliseconds minus the number of milliseconds played
if(leftsec<10){leftsec = "0"+leftsec}
if(leftmin<10){leftmin = "0"+leftmin}
if(leftmilli<10){leftmilli = "0"+leftmilli}
//The above three sentences are preceded by a "0" when the number of minutes, seconds and milliseconds is less than 10.
if(leftmilli<=1){totalmilli+=100;} );
//When the remaining milliseconds are less than 1, add 100 to the total seconds for the next re timing (note that the number of milliseconds for movie playback keeps increasing)
If (leftsec==0) {//When the remaining seconds are equal to 0
totalsec+=60;// Similar to the above explanation, the total seconds add 60
totalmin-=1;// At this time, it is equivalent to 60 seconds, so the minutes should be reduced by 1
If (leftmin==0) {//When the number of minutes equals 0, the timing ends
leftsec = "00"; ,
leftmin = "00";
leftmilli = "00";
//Add 0 to all three timing boxes
delete onEnterFrame;// Delete this frame by frame action to save resources
};
}
}

13. Keyboard control up, down, left and right
How to use the keyboard up, down, left and right control animation!
onClipEvent (load) {
speed = 5;// When MC is loaded, the speed is set to 5, that is, every time you press the direction key, it will move 5 pixels
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._ x -= speed;// When ← is pressed, its X position decreases speed, and the X axis coordinate decreases, that is, it moves to the left continuously
}
if (Key.isDown(Key.RIGHT)) {
this._ x += speed;// When → is pressed, its X position increases speed continuously, and the X axis coordinate increases continuously, that is, it moves continuously to the right
}
if (Key.isDown(Key.UP)) {
this._ y -= speed;// When ↑ is pressed, its Y position decreases speed continuously, and the Y-axis coordinate decreases continuously, that is, it moves upward continuously
}
if (Key.isDown(Key.DOWN)) {
this._ y += speed;// When ↓ is pressed, its Y position increases speed continuously, and the Y-axis coordinate increases continuously, that is, it moves downward continuously
}
}
onEnterFrame. = function () {
if (Key.isDown(Key.LEFT)) {
mc._x -= 20;
}
if (Key.isDown(Key.RIGHT)) {
mc._x += 20;
}
if (Key.isDown(Key.UP)) {
mc._y -= 20;
}
if (Key.isDown(Key.DOWN)) {
mc._y += 20;
}
if (mc._x<0) {
mc._x = 0;
}
if (mc._x>550-mc._width) {
mc._x = 550-mc._width;
}
if (mc._y<0) {
mc._y = 0;
}
if (mc._y>400-mc._height) {
mc._y = 400-mc._height;
}
}

14. Call external pictures randomly
Take 9 pictures as examples. This can also be called with loadmovie
num=Math.round(9*Math.random()+1)
//Set random number (1-9)
_root.createEmptyMovieClip("pic", 1);
//Create an empty PIC MC to load pictures loaded outside
_root.pic._ x = 200;
_root.pic._ y = 200;
//Simply set the position of MC
_root.pic.loadMovie(num+".jpg",1);
//The external picture is loaded immediately

15. Pause
You can lengthen the frames where you want to pause
Or write in the current frame
stop();
function pause(){
clearInterval(pauseInterval);
play();

pauseInerval=setInterval(pause,1000); // 1000 is one second

16. How to change the playback speed of a film clip
function go(obj) {
with (obj) {
nextFrame();
if (_currentframe. == _totalframes) {
gotoAndStop(1);
}
}
)
go(mc);
setInterval(go, 100, mc);

17. How to call. chm file
getURL(mk:@MSITStore:F:...xxx.chm::/index.htm)

18. Randomly generate an array with 30 numbers. The 30 numbers are randomly taken between 1 and 500, and cannot be repeated. They should be out of order.
tmp = new Array();
k = new Array();
for (i=0; i<=499; i++) {
tmp = i+1;
}
for (i=0; i<=29; i++) {
k = tmp.splice(random(tmp.length-1), 1);
}
trace(k);

Flash button action code
________________________________________

Flash button action code

1. Go to the next frame and continue playing
on (release)
{
play();
}

2. Go to the third frame and play
on (release)
{
gotoAndPlay(03);
stopAllSounds();
}

3. Full screen playback
fscommand("fullscreen", "true");

4. Exit
on (release)
{
if (substring(_root._url, 8, 1) == "/")
{
fscommand("quit");
}
else
{
getURL("javascript:window.close()");
} // end if
}

5. Return to the first frame
on (release)
{
gotoAndPlay(01);
stopAllSounds();
}

Complete Code of FLASH Script
-Go to jump to the specified frame
-Play
-Stop
-Toggle High Quality switches between high quality and low quality
-Stop All Sounds
-Get URL jumps to a hyperlink
-FSCommand Send FSCommand Command
-Load Movie
-Unload Movie
-Tell Target
- If Frame Is Loaded .. Determine whether the frame is fully loaded
-On Mouse Event
Other Actions. include:
-Break out of the loop
-Call calls the specified frame (usually calling a specific function)
-Comment
-Continue Continue the cycle
-Delete Deletes a variable in an object
-Do while do while loop
-DuplicateMovieClip Replication MC
-Else (used with if)
-Else if
-Evaluate Call custom function
-For for loop
- for .. In order to obtain each attribute in an object or all elements in an array
-FSCommand Send FSCommand Command
-Function Declare a user-defined function
-GetURL jumps to a hyperlink
-Goto jumps to the specified frame
-If if
- ifFrameLoaded .. Whether the frame is fully loaded
-Include Read the external ActionScript program file (. as)
-LoadMovie Load MC
-LoadVariables reprints data in external files, which can be text files or text values returned by ASP/CGI and other scripts
-On trigger conditions of mouse events
-Event trigger of onClipEvent MC
-Play
-Print output to printer
-RemoveMovieClip Delete MC
-Return Returns a value in a function
-Set variable
-SetProperty Set property
-StartDrag starts dragging
-Stop Stop
-StopAllSounds Stops the playback of all sounds
-StopDrag
-SwapDepths Exchange the depth of two MCs
-TellTarget specifies the target to which the Action command takes effect
-ToggleHighQuality switches between high quality and low quality
-Trace trace debugging
-UnloadMovie Uninstall MC
-Var Declare local variables
-While while When established
-With Object does

Operators
- ! Logical non operation
- != Not equal to
-"" string
-% remainder
-&&Logic and Operation
-() Bracket
-* Multiplication sign
-+Plus
-++variable self plus one
-- minus sign
--- Variable minus one
-/Division
-<less than
-<=less than or equal to
-<>Not equal to
-==Equal
->Greater than
->=greater than or equal to
-And logic and
-Not logical non
-Or logical or
-Typeof Return variable type
-Void entity, no return
-Logical OR operation
+Bitwise Operators
-Bit&and Operation
-<<Bit Shift Left
->>Bit Shift Right
->>>Bit shift right (unsigned)
-^ bit XOR operation
-| Bit or operation
-~Place filling operation
+Compound Assign Operators
-%=A%=B is equivalent to A=A% B
-&=A&=B is equivalent to A=A&B
-*=A *=B is equivalent to A=A * B
-+=A+=B is equivalent to A=A+B
--=A -=B is equivalent to A=A-B
-/=A/=B is equivalent to A=A/B
-<<=A<<=B is equivalent to A=A<<B
->>=A>>=B is equivalent to A=A>>B
->>>=A>>=B is equivalent to A=A>>>B
-^=A ^=B is equivalent to A=A ^ B
-|=A |=B is equivalent to A=A | B
+String Operators
-Add concatenates two strings
-Eq A eq B The string A value is equal to the string B value
-Ge A ge B string A value is greater than or equal to string B value
-Gt A gt B string A value is greater than string B value
-Le A le B string A value is less than or equal to string B value
-Lt A lt B string A value is less than string B value
-Ne A ne B string A value is not equal to string B value
+Functions
-Boolean Get the Boolean value of the expression (True or False)
-Escape removes illegal characters from the URL string and converts its parameters into strings in the URL encoded format
-Eval accesses and calculates the value of the expression, and returns the value as a string
-False Boolean non value (0)
-GetProperty Get the property
-GetTimer gets the total playback time (milliseconds) from the beginning of the movie to the present
-GetVersion Get the version number of the browser's FLASHPlayer
-The coordinates in the globalToLocal scene (Scene) are converted to the coordinates in MC
-HitTest tests whether a point or MC intersects with another (i.e. conflict detection)
-Int Casts a decimal value to an integer
-IsFinite Test whether the value is finite
-IsNaN test whether it is non numeric
-Keycode returns the keyboard value of the pressed key (ASCII value)
-The coordinates in localToGlobal MC are converted to the coordinates in Scene
-Maximum line size of maxscroll text box
-Newline line feed
-Number converts a parameter to a numeric value and its return value can be in the following four cases:

If x is a number, the return value is the number; If x is a boolean number, 0 or 1 is returned; If x is a string, the function interprets x as an exponential decimal number; If x is undefined, 0 is returned.
-ParseFloat converts a string to a floating point number
-ParseInt converts a string to an integer
-Random generates a random number between 0 and the specified number
-Start scrolling line in scroll text box
-String converts the parameter to a string
-TargetPath returns the path string of the specified instance MC
-True Boolean is a value (1)
-Unescape reserves hexadecimal characters in% XX format in strings
+String Functions
-Chr converts ASCII code to corresponding characters
-Length Returns the length of a string
-Mbchr converts ASCII/S-JIS encoding into corresponding multi byte characters
-Mblength returns the length of a multi byte string
-Mbord converts multi byte characters into corresponding ASCII/S-JIS codes
-Mbsubstring intercepts a string in a multi byte string
-Ord converts characters into ASCII codes
-Substring intercepts substrings in a string
+Properties
-_alpha Alpha value (transparency value)
-_currentframe Current frames in MC
-_droptarget When dragging an MC with Start drag, the absolute path of the MC is returned in real time
-Whether the focused button or a current area is displayed (True display/Flash not display)
-_framesloaded
-_height The height of the MC
-_highqualityHigh or low picture quality (True high picture quality/False low picture quality)
-_name Instance name of MC
-_quality Current image quality (string value) LOW, MEDIUM, HIGH, BEST
-_rotation MC rotation angle in degrees
-Buffer size of _soundbuffime sound (default value 5, unit: seconds)
-Path of _target MC
-_totalframes Total Frames
-_url The URL address where the movie is called
-_Visible (True Visible/False Invisible)
-_width Width of MC
-_x MC's x coordinate
-_xmouse x coordinate
-_xscale MC's X-axis scaling
-Y coordinate of _y MC
-_ymouse mouse y coordinate
-_yscale MC's y-axis scaling
+Objects
+Array
-Concat Merges multiple arrays
-Join converts the elements in an array into strings, joins them through specific separators, and returns the result string
-Length returns the array length
-New Array
-Pop out (FILO first in and then out)
-Push to stack (queue)
-Reverse (invert the array, and exchange the first element with the last element...)
-Shift out queue (FIFO first in first out)
-Slice intercepts substrings in an array to generate a new array
-Sort array elements
-Splice deletes the specified number of elements from the specified element in the array or deletes the specified element
-Unshift inserts an element from the array head
+Boolean object
-New Boolean
-ToString converts the value of a Boolean object to a string value
-ValueOf Get the value of a Boolean object (the return value is Boolean)
+Color object
-GetRGB Get the RGB component of the color value (return value 0xRRGGBB hexadecimal)
-GetTransform gets the conversion amount of the color value (return value cxform type) [unclear]
-New Color Create a new color object
-SetRGB Sets the RGB component of the color value (the parameter is 0xRRGGBB hexadecimal)
-SetTransform Sets the conversion amount of the color value (the parameter is cxform) [unclear]
+Date Time and date objects
-GetDate gets the current date (the date of this month)
-GetDay gets the day of the week (0-Sunday, 1-Monday...)
-GetFullYear gets the current year (four digits)
-GetHours gets the current hours (24-hour format, 0-23)
-GetMilliseconds Get the current number of milliseconds
-GetMinutes Get the current minutes
-GetMonth gets the current month (note from 0: 0-Jan, 1-Feb...)
-GetSeconds Get the current seconds
-GetTime Gets the number of seconds in UTC format since 1970.1.1 0:00
-GetTimezoneOffset Get the offset value of the current time and UTC format (in minutes)
-GetUTCDate Get the current date in UTC format (date of this month)
-GetUTCDay Get the day of the week in UTC format (0-Sunday, 1-Monday...)
-GetUTCFullYear Get the current year in UTC format (four digits)
-GetUTCHours Get the current hours in UTC format (24-hour format, 0-23)
-GetUTCMilliseconds Gets the current number of milliseconds in UTC format
-GetUTCMinutes Get the current minutes in UTC format
-GetUTCMonth Get the current month in UTC format (note that starting from 0: 0-Jan, 1-Feb...)
-GetUTCSeconds Gets the current number of seconds in UTC format
-GetYear gets the current abbreviation year (current year minus 1900)
-New Date Create a new date time object
-SetDate sets the current date (the date of this month)
-SetFullYear Sets the current year (four digits)
-SetHours Sets the current hours (24-hour, 0-23)
-SetMilliseconds Sets the current number of milliseconds
-SetMinutes Sets the current minutes
-SetMonth sets the current month (note that starting from 0: 0-Jan, 1-Feb...)
-SetSeconds Sets the current seconds
-SetTime Sets the number of seconds in UTC format since 1970.1.1 0:00
-SetUTCDate Sets the current date in UTC format (the date of this month)
-SetUTCFullYear Sets the current year in UTC format (four digits)
-SetUTCHours Sets the current number of hours in UTC format (24-hour format, 0-23)
-SetUTCMilliseconds Sets the current number of milliseconds in UTC format
-SetUTCMinutes Sets the current minutes in UTC format
-SetUTCMonth Sets the current month in UTC format (note that starting from 0: 0-Jan, 1-Feb...)
-SetUTCSeconds Sets the current number of seconds in UTC format
-SetYear sets the current abbreviation year (current year minus 1900)
-ToString converts the date time value into a string value in the form of "date/time"
-UTC returns the fixed time value of the specified UTC format date time
+Key Keyboard Object
-BACKSPACE Backspace (<-) key
-CAPSLOCK CapsLock key
-CONTROL Ctrl
-DELETEKEY Delete (Del) key
-DOWN
-END End key
-ENTER
-ESCAPE Esc
-GetAscii Get the Ascii code of the corresponding character of the last key pressed or released
-GetCode Get the keyboard scan code of the last key pressed
-HOME Home key
-INSERT Insert (Insert) key
-IsDown returns True when the specified key is pressed
-IsToggled Returns True when Caps lock or Num Lock is locked
-Left key of LEFT direction
-PGDN PageDown (PGDN) key
-PGUP PageUp (PGUP) key
-Right click the RIGHT direction
-SHIFT Shift
-SPACE
-TAB Tab
-UP direction up key
+Math Math Function Object
-Abs abs (n) is the absolute value of n
-Acos The arccosine of acos (n) n (return value unit: radians)
-Asin asin (n) The arcsine of n (return value in radians)
-Atan The arctangent of atan (n) n (return value in radians)
-Atan2 atan2 (x, y) Calculate the arctangent of x/y
-Ceil ceil (n) Take an integer close to the upper limit of n (round up)
-Cos cos (n) is the cosine of n (unit of n: radians)
-E Euler index (about 2.718)
-Exp index
-Floor floor (n) Take an integer close to the lower limit of n (round down)
-LN10 ln10 (about 2.302)
-LN2 ln2 (about 0.693)
-Log takes the natural logarithm (e is the base)
-LOG10E 10 is the logarithm of base E (about 0.434)
-LOG2E 2 is the logarithm of base E (about 1.443)
-Max returns the maximum value of the two parameters
-Min returns the minimum value of the two parameters
-PI Pi (about 3.14159)
-Pow pow (x, y) x to the y power
-Random produces random numbers between 0-1
-Round
-Sin sin (n) is the sine of n (n is in radians)
-Sqrt square root
-SQRT1_2 0.5 square root (approximately equal to 0.707)
-SQRT2 2 square root (approximately equal to 1.414)
-Tan tan (n) Take the tangent of n (unit of n: radians)
+MovieClip Movie Clip Subobject
-AttachMovie generates an entity of MC in the library and binds it to a movie
-DupicateMovieClip replicates the current MC to generate a new MC
-GetURL enables the browser to browse the specified page
-GotoAndPlay Jumps to the specified frame and plays
-GotoAndStop Jumps to the specified frame and stops playing
-LoadMovie introduces an external movie to the specified layer
-LoadVariables Import variable values from external files
-NextFrame Next Frame
-Play
-PrevFrame Previous Frame
-RemoveMovieClip Deletes MC created with duplicateMovieClip
-StartDrag starts dragging MC
-Stop Stop MC playing
-StopDrag Stop dragging MC
-UnloadMovie Unloads the movie introduced by loadMovie
+Mouse object
-Hide hide the mouse pointer
-Show Show mouse pointer
+Number numeric object
-MAX_value Maximum value allowed by FLASH5 1.79769313486231 e 308
-MIN_value Minimum value allowed by FLASH5 5 e - 324
-Not a Number
-NEGATIVE_INFINITY is negative
-New Number
-Whether POSITIVE_INFINITY is a positive number
-ToString Converts a numeric value to a string
+Object
-New Object
-ToString converts object to string
-ValueOf returns the value of the object
+Selection Selection Area Object
-GetBeginIndex gets the starting position of the editable text area. - 1 means no editable text area
-GetCaretIndex gets the current editing position. - 1 means there is no editable text area
-GetEndIndex gets the end position of editable text area. - 1 means no editable text area
-GetFocus gets the text variable name of the current active text area
-SetFocus sets the current active text area
-SetSelection Sets the start and end position of editable text
+Sound Object
-A sound in the attachSound binding library
-GetPan gets the sound mixing value [unclear]
-GetTransform gets the transformation amount of the current sound (return value type: sxform) [unclear]
-GetVolume Gets the volume (percentage) of the current sound
-New Sound
-SetPan Set the sound mixing value [not clear]
-SetTransform Sets the transformation amount of the current sound (parameter type: sxform) [unclear]
-SetVloume Sets the volume (percentage) of the current sound
-Start Start playing the current sound
-Stop Stop playing the current sound
+String string object
-CharAt returns a character in the specified index table
-CharCodeAt returns a code of one character in the specified index table
-Concat concatenates multiple strings
-FromCharCode constructs a new string from a character code group
-IndexOf looks for a substring in a string and returns the starting position of the substring or - 1 (- 1 means not found)
-LastIndexOf looks for a substring in a string and returns the substring end position or - 1 (- 1 means not found)
-Length Returns the length of a string
-New String Create a new string object
-Slice returns the substring specified in the string
-Split converts the string into an array according to the qualifier
-Substr substr (start, length) returns a substring of length from start
-Substring substring (indexA, indexB) returns indexA Substring between indexB
-ToLowerCase converts all uppercase characters in the string to lowercase
-ToUpperCase converts all lowercase characters in the string to uppercase
+XML Extensible Markup Language Object
-AppendChild adds a child node to the specified XML element
-Attribute array of attributes XML element
-ChildNodes An array of child nodes of an XML element
-CloneNode Clone (copy) the current node
-CreateElement Create a new XML element
-CreateTextNode Create a new XML text node
-FirstChild returns the first child node of the current XML node
-HasChildNodes Whether the current XML node has child nodes (if true is returned, then none)
-InsertBefore inserts a new child node before the child node of a specified XML element
-LastChild returns the last child node of the current XML node
-Load introduces XML elements into FLASH from the specified URL
-Loaded When an XML element is introduced into or sent to FLASH at the same time, the value of true is returned
-New XML Create a new XML object
-NextSibling The next node of the current XML node
-NodeName returns the name of the current XML node
-NodeType returns the type of the current XML node (1-element, 3-text)
-Nodevalue returns the value of the current XML node (text type returns text)
-OnLoad Triggers the event when importing or sending simultaneously
-ParentNode returns the parent node of the current XML node
-ParseXML converts an XML string into an XML object
-PreviousSibling The previous node of the current XML node
-RemoveNode Deletes a node from XML text
-Send sends an XML element from FLASH to the specified URL address
-SendAndLoad sends an XML element from FLASH to the specified URL address and introduces XML results
-ToString converts an XML object into an XML string representation
+XMLSocket XML socket
-Close Closes an XML socket
-Connect to connect an XML socket, specify the URL, and define its port number
-New XMLSocket creates a new XML socket
-The event is triggered when onClose closes the XML socket
-The event is triggered when onConnect connects to the XML socket
-The event is triggered when onXML gets XML from the server
-Send sends XML to the server

FLASH Action Script Code Collection

1. Simple loading code:
Method 1. Use the number of loaded bytes to judge
b=getBytesTotal(); Get the total number of bytes
a=getBytesLoaded(); Number of bytes downloaded
OnEnterFrame=function() {Judge when entering the frame
If (a==b) {If the number of bytes loaded is equal to the total number of bytes
Delete this.onEnterFrame
gotoAndPlay(frame); Go to the frame you want to play
]Else {otherwise
a=getBytesLoaded(); Number of bytes downloaded
percent=int(ab100)+%; Calculate the percentage that has been downloaded
]
}
Put the above method into the first frame

Method 2. Use the loaded frames to judge_
It is implemented with the action syntax if frame is loaded. Create a new layer, which is dedicated to the action,
First frame,
IfFrameLoaded (scene, frame) {If the frame number in the scene has been loaded
Goto and play()
}
Frame 2, ONp@Q
Goto and play (Scene 1, 1)
Add a load MC to play in the middle of the two frames, and it is OK.
2. Use flash to create small pop-up windows
There are two steps:
Add the following actions to the buttons in flash
on (release) { idd{
getURL (MM_openBrWindow('newweb.htm','','width=600,height=100'));
In the head of the HTML page Add the following javascr between the heads ī Pt code
scr ī pt language=javascr ī pt
!-- ~ Y
function MM_openBrWindow(theURL,winName,features) { v2.0
window.open(theURL,winName,features); ;
}
--
scr ī pt

3. Control of loading swf files
In flash, you can use the loadmovie () and loadmovie () functions to control. The specific code is as follows:
Control of loadmovie loading
_root.createEmptyMovieClip ( aa , 1 );
with ( aa ) {
_x = 50 ;
_y = 100 ;
_width=200
_height=300
_alpha=50
loadMovie ( 02.swf );
}
Loading control of loadMovieNum:
loadMovieNum ( 02.swf , 1 );
onEnterFrame = function () {
if ( _level1 ) {
with ( _level1 ) {
_x = 50 ;
_y = 100 ;
}
delete onEnterFrame ;
}
};
In flash 2004, the MovieClipLoader class was added to control playback. Here is a test code:
var mcl= new MovieClipLoader(); Define a new MovieClipLoader object ~
var listener = new Object(); Define a new object to listen to the load process
Listener. onLoadProgress=function (target, loadedBytes, totalBytes) {onloadprogress Load

Called whenever the loaded content is written to the disk during the
Where loadedBytes is the downloaded bytes, and totalBytes is the total bytes of the file being added
x=loadedBytes
y=totalBytes
Trace (x+bytes have been loaded);
Trace (totalBytes+bytes requires load);
D=x100y Calculate the loaded percentage
)
Listener. onLoadInit=function (target) Called when the action on the first frame of the loaded clip is executed
{
If (d100) {If the loading is not completed, do not play
target.stop();
}Else {After loading, you can set the number of frames to start playing the loaded swf file
target.gotoAndPlay(2);
}
target._ Width=400 Set the size and position of the loaded movie and other related attributes
target._ height=350
target._ x=25
target._ y=50
}
mcl.addListener(listener); Register a new listener object
Mcl. loadClip (. swf, 1) Use custom objects to load swf files

4. Set as Home Page
on (release) {
getURL(void(document.links.style.behavior='url

(#default#homepage)'); voiddocument.links.setHomePage(' httpwww.flash8.net'),_self,

POST);
}
Note that the ID number of the flash in the web page should be named links

Add to Favorites
on (release) {
GetURL (void window. external. AddFavorite ('httpwww.163. com', 'webpage')_ self, POST);
}

5. How to set MC color randomly?
Method 1. The MC instance is named mc
mycolor=new Color(mc)
mycolor.setRGB(random(0xffffff))
Method 2. The MC instance is named mc
mycolor=new Color(mc) [
mycolor.setRGB(random(16777215))
Method 3. myColor=new Color (mc);
myColorTransform = new Object(); Use new Object() as
SetTrandform() creates parameters and takes random values
myra = random(100);
myrb = random(255);
myga = random(100);
mygb = random(255);
myba = random(100);
mybb = random(255);
myaa = random(100);
myab = random(255);
myColorTransform = {ramyra, rbmyrb, gamyga, gbmygb, bamyba, bbmybb, aamyaa,

abmyab};
myColor.setTransform(myColorTransform);
Method 4. mycolor=new color (mc);
mycolor.setRGB(random(255)16random(255)8random(255));

6. Skills on Random Numbers
Used to generate 5 non repeated random numbers between 6 and 20
1) First, a random number is generated and placed at the first position in the array object
2) Generate a new random number
3) Check whether the newly generated random number is the same as all the currently generated random numbers. If they are the same, return (2); otherwise, return (4)
4) Add a new random number to the next array element in the array object
5) Check whether the number of array objects has reached 5, if it jumps to (6), otherwise it returns (2)
6) End
AS as follows
data1=newArray(5);
tot=1;
data1=[tot-1]=random(20-6+1)+6;
do{
gen_data=random(20-6+1)+6;
reapeat_data=0;
for(i=0,i=tot-1;i++){
if(gen_data==data
reapeat_data=1;
break;
}
}
if(reapeat_data==0){
tot++
data[tot-1]=reapeat_data;
}
}while(tot5);
trace(data1);

7. How to disable right-click menu, zoom and full screen
Enter the following command in the first frame:
Full screen ->FS Command (fullscreen, true)
No zoom ->FS Command (allowscale, False)
Forbidden menu ->FS Command (showmenu, False)
The fscommand method is still only applicable to fp, and additional parameters must be added to use it in web pages
PARAM Name=menu value=false
Or use the simplest sentence as, which is applicable to both fp and webpage:
Stage.showMenu=false;

8. How to achieve double click effect?
Put the following code on the button:
on (press) {
time = getTimer()-down_time;
if (time300) {
trace(ok);
}
down_time = getTimer();
}
In this case, if it is troublesome to use them, write a class to judge
MovieClip.prototype.doubleClick = function() {
this.timer2 = getTimer()1000;
if ((this.timer2-this.timer)0.25) {
return true;
} else {
this.timer = getTimer()1000;
return false;
}
};
Classes that inherit mc can be reused, or can be encapsulated as 2. Class of 0

9. To achieve full screen effect in the browser, just add the following code to the html file:
scr ī pt
window.open(.swf,,fullscreen=1,menubar=no,width=800,height=600)
scr ī pt
Where. swf is the FLASH file to be called. Remember to place the file under the same path of the html file. To exit full screen

Press ALT+F4 or exit.
If you add a close button in the swf file, use the following code:
on(release) {
getURL(opener=null;window.close(););
}

10. How to play the film backwards with AS
function prev(target) {
target.gotoAndStop(target._totalframes);
target.onEnterFrame = function() { [
if (this._currentframe1) {
this.gotoAndStop(this._currentframe-1);
} else {
delete this.onEnterFrame;
}
};
}
prev(_root.mc); Specify the MC instance name to play backwards

11. Sound correlation
Previously linked an attribute for MYSOURCE
1 : mysound=new Sound(); (Note) mysound is a variable name, new Sound is a constructor, and the table

It shows that mysound is a Sound object.
You can call the Sound method} HK through mysound later[
2: mysound.attachSound(name); The NAME here is what you wrote in the identifier before, and it will be OK after the corresponding


3: mysound.setVolume(50); This is to control the sound size when playing the sound. The value ranges from 0 to 100, meaning everyone

You know, no one thinks 0 is the loudest~
4:mysound.start(0.01); This statement indicates the start of playing the sound. The parameters in () indicate the position where the sound starts. Unit:

Is seconds, and then it will cycle several times~for example, mysound. start (30, 2); The sound is cycled twice from 30 seconds.

12. Countdown
First, after creating a new file, use the text tool to create three dynamic text boxes in the main scene. The variable names are:

Leftmin, leftsec, leftmilli, that is, to display the minutes, seconds, and milliseconds of timing respectively.
Then create a new layer and write the following code on the first frame:

Means)
OnLoad=function() {Execute after the scene is loaded
totalmin = 40;
totalsec = 60;
totalmilli = 100;
Initialize some variables, which will be used in later calculations
}
ō NEnterFrame=function() {Execute the action frame by frame
currentsec = Math.round(getTimer()1000);
Find the number of seconds that the current movie has played (rounded)
currentmilli = Math.round(getTimer()10);
Find the number of milliseconds that the current movie has played (rounded)
leftsec = totalsec- currentsec;~
The remaining seconds are equal to the total seconds minus the played seconds
leftmin = totalmin; ^
The number of starting minutes is equal to the total number of minutes, and the beginning is unchanged
leftmilli = totalmilli - currentmilli;
The number of milliseconds remaining is equal to the total number of milliseconds minus the number of milliseconds played
if(leftsec10){leftsec = 0+leftsec}
if(leftmin10){leftmin = 0+leftmin}
if(leftmilli10){leftmilli = 0+leftmilli}
The above three sentences are preceded by a "0" when the number of minutes, seconds and milliseconds is less than 10.
if(leftmilli=1){totalmilli+=100;} );
When the remaining millisecond is less than 1, add 100 to the total seconds for the next time(
This article was published on Beijing website construction Company Shangpin China //ihucc.com/
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]