Build the FLA file. Name casually (I took Testllk.fla)Create a new movie clip in the FLA (name is Mov_tupian), add your favorite pictures inside, each frame, align the origin. Write a Stop () in the first frame, and change the connection class to Tupian.Create a new movie clip in the FLA (name me Line-mov) and add a box inside it, just as big as the picture in the movie clip. Change the connection class to Kuan.Write Testllkan in the text as a class.
Llkan.as Code
Package {/*** Repeatedly look
generates 1 ~ 10Random INTEGERVaR random4: Number = math. Floor (math. Random () * 10) + 1
8. Shuffling Arrays
In games, random numbers are most commonly used in card game shuffling. For example, you have 52 cards in your hand,What should I do if I want to randomly disrupt it?First, you need to create a new array, which is simply arranged in order. The following code displays ordered numbers from 0 to 51// Create an ordered arrayVaR startdeck:
1. Change the color of a row based on its value.
1. Create a project and add a code layer. The code in the Code layer is as follows:
Import fl. data. DataProvider;
Var dataGrid: DataGrid = new DataGrid ();DataGrid. x = 100;DataGrid. y = 100;DataGrid. setSize (400,200)AddChild (dataGrid );
Var d: Array = new Array ();D = [{Name: 'zhang san', December January: 200, December February: 300, December March: 40
Turn: http://www.cnblogs.com/huomiao/archive/2009/12/26/1626293.html
A Sequence Chart requiring human movement
By changing the bitmapData attribute of a Bitmap instance, you can dynamically change the display of a Bitmap instance on the stage.
Then, you can set the enterFrame or Timer event so that the bitmapData attribute of the Bitmap instance is constantly changing to achieve the walking effect of the characters.
Package{
Import flash. display. Bitmap;
Import flash. display. BitmapData;
Impor
Package
{
Import flash. display. MovieClip;
Import flash. display. Sprite;
Import flash. events. Event;
Import flash. events. MouseEvent;
Import flash. geom. Rectangle;
Import flash. media. Sound;
Import flash. text .*;
Public class Main extends Sprite{Public static const STATE_INIT: int = 10;Public static const STATE_PLAY: int = 20;Public static const STATE_GAME_OVER: int = 30;Public var gameState: int = 0; // game statusPublic var score: int = 0; // score of the playerPublic var chances: int
Notes
The new for Each ... In addition to traversing XML, can also be used to traverse arrays and objects. Create "Million Xiong":
var testarr:array = new Array ();for (var i:number = 0; i {Testarr.push (i);}
Previous for and for ... in and new for Each ... in loop:
For 260 millisecondsvar len:number = testarr.length;for (var j:number = 0; J {testarr[j]++;}For ... in 8000 millisecondsfor (Var k:string in Testarr){testarr[k]++;}For each ... in 58 milli
Package {
Import flash. display. Sprite; import flash. Events. event; import flash.net. urlloader; import flash.net. URLRequest; import flash. Text. textfield;
Public class test extends sprite {var textfield: textfield; var arrdirty: array; var arrname: array; Public Function Test () {textfield = new textfield (); var Loader: urlloader = new urlloader (); loader. addeventlistener (event. complete, oncomtxtc
New for each... Besides traversing XML, in can also be used to traverse arrays and objects. Create "millions of troops ":VaR testarr: array = new array ();
For (var I: Number = 0; I
{
Testarr. Push (I );
}
Previous for and... In and the new for each... In loop:// For 260 milliseconds
VaR Len: Number = testarr. length;
For (var j: Number = 0; j
{
Testarr [J] ++;
}
//... In 8000 milliseconds
For (var k: S
One, depending on a value of the row, change the row color
1. Create a new project, add the code layer, the code in the Code layer is as follows:
Import Fl.data.DataProvider;
var datagrid:datagrid = new DataGrid ();datagrid.x = 100;DATAGRID.Y = 100;Datagrid.setsize (400,200)AddChild (DataGrid);
var d:array = new Array ();D = [{name: ' Zhang San ', January: 200, February: 300, March: +, Rowcolor: ' Red '},{name: ' John Doe ', January: 300, February:
objects. When you need to use it, first determine whether there are objects in the idle list. If there are objects, retrieve them directly. If not, create a new one and put it in a list.
Another example is that you need to refresh the same type of monsters in a map without any other steps. You don't need to refresh the monsters every time, but just reinitialize those dead monsters.
6. effectively release memory
The Flash Player garbage collection mechanism uses the price clearance mechanism. Be
A few days ago, I saw someone using Silverlight as a "greedy snake" in the garden. on the rise, I also wanted to use as3.0. Although this game has been ruined by many developers, however, as a beginner, it is also a learning method to repeat it.
Analysis of technical difficulties:
1. Composition of the snake bodyYou can use arrays to store a bunch of small balls and arrange them into continuous straight lines.
2. Snake body movementAfter the snake head moves, the ball following the snake head m
/parta. mass;Parta. Vy + = Ay/parta. mass;Partb. VX-= AX/partb. mass;Partb. Vy-= Ay/partb. mass;}
Cosine theoremA2 = B2 + C2-2 * B * C * CosB2 = a2 + C2-2 * a * C * Cos BC2 = a2 + B2-2 * a * B * Cos C
Cosine theorem of ActionScript:A = math. ACOs (B * B + C * C-A * A)/(2 * B * C ));B = math. ACOs (A * A + C * C-B * B)/(2 * a * C ));C = math. ACOs (A * A + B * B-c * C)/(2 * a * B ));
Basic Methods:Scale = fL/(FL + zpos );Sprite. scalex = Sprite. scaley = scale;Sprite. Alpha = scale; // optionalSp
Today we need to use random numbers. I thought there was a random number class like Java. The result is in the math class. What I need is an integer, 0-15, and 10, which cannot be repeated, the Code is as follows:
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->VaR ITN: array = new array ();
While (ITN. length! = 10 ){
// The most important code is the
clicking the browse buttonLiulan.addeventlistener (Mouseevent.click,click_liulan);Click the Upload button when the eventShangchuan.addeventlistener (Mouseevent.click,up_load);}============================================= a gorgeous split line ======================================================== ======//Private Function Click_liulan (e:mouseevent): void {Set File typevar imagetypes:filefilter=new filefilter ("Images (*.jpg, *.jpeg, *.gif)", "*.jpg;, *.jpeg;, *.gif;");Put the desired file ty
Game effect
Create a new FLA and add code to the first frame F9.
The code is as follows
Copy Code
var arr:array = new Array ();var time:uint=0;var angle:number=0;var Zfun;[SWF (width=800, HEIGHT=465,BACKGROUNDCOLOR=0XFFFFFF, framerate=24)]This.addeventlistener (Event.enter_frame,function (Event) {time++;angle+=0.1;if (time>=13) {var Tf:textfield = addChild (New TextField ()) as TextField;Zfun = function () {time = 0,tf.ht
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.