Actionscript 3.0 Syntax Cheat SheetDeclaring a variableSetting a varia การแปล - Actionscript 3.0 Syntax Cheat SheetDeclaring a variableSetting a varia ไทย วิธีการพูด

Actionscript 3.0 Syntax Cheat Sheet

Actionscript 3.0 Syntax Cheat Sheet
Declaring a variable
Setting a variable’s value
Arrays:
Creating
Manipulating
Objects:
Creating and Manipulating
Accessing
Loops
Moving Items
Removing Items
The Display List:
Adding Items
Operators Conditionals (Evaluations of True or False) Math
var MyVar:Boolean;
var MyVar:Boolean = true;
var VariableName:DataType;
Blue: AS3 Reserved Words Red: Words to replace (defines
what should go there)
Black: Words with no AS3 dependency or
caracters necessary for code to work
MyVar = true;
var VariableName:DataType = value; VariableName = value;
var myArr:Array = new Array(‘item1’, 2, myVar3);
var myObj:Object = new Object();
myObj.myParam = ‘my value’; //create as many properties as you want
for(var i:int = 0; i < 10; i++) { //value of i each iteration: 0,1,2,3,4,5,6,7,8,9 }
for(initializer; condition; counter) { //Loop continues until the condition is false
while(condition) { //Loop continues while the condition is true and ends when it is false }
var i:int = 0;
while(i < 10) {
i++ //Once i increments to 10 the loop condition will be false
}
myObj.parameter; //if the parameter does not exist it returns undefined
var myObj:Object = {myParam:‘myValue’}; //same as previous
var myArr:Array = [‘item1’, 2, myVar3]; //same as previous
myArr.push(4); //puts the value 4 on the end of the array
myArr.shift(); //removes the first item from the array
trace( myArr[0] ); //the 0 index is always the first item in the array
trace( myObj.myParam ); //access the value of myParam: ‘my value’
trace( myArr[ myArr.length-1 ] ); //access the last item in the array
ArrayName[index]; //replaced by the item in the array at that index
//declared but not initialized
//example of declaring a Boolean
//declare & set //already declared
this.addChild(MyMovieClip);
this.removeChild(MyMovieClip);
this.addChildAt(MyMovieClip, 0);
this.swapChildren(MyChildClip1, MyChildClip2);
this.setChildIndex(MyMovieClip, 2);
this.swapChildrenAt(0, 1);
MovieClipName.addChild(MovieClipNameToAdd);
ParentClipName.removeChild(MovieClipNameToRemove);
//assuming this is within a MovieClip class, or on the Timeline
//Remember that the Display List is just an Array
//Objects at a lower index are behind items at a higher index
//Swaps the objects at index 0 and 1
//Swaps the two child clips.
//Moves the clip to index 2
if(false){ //will not run } i++; //same as i += 1; //same as i = i+1;
+
-
*
/
%
=
==
!=
<

>=
!
&&
||
increment and decrement
calculations and operations
i--; //same as i -= 1; //same as i = i-1;
i = 10*10; //100 i = 10/10; //1 i = 10%10; //0
i = Math.random(); //number between 0 and 1
i = Math.round(1.5); //2 normal math rounding
i = Math.ceil(1.1); //2 always rounds up
i = Math.floor(1.8); //1 always rounds down
if(true) { //will run }
if(isDone) { //if isDone is true
//code here will run
} else if(!isLoaded) { //if isLoaded is not true
//code here will run
} else { //otherwise code here will run }
if(myString == ‘Hello’) {} //string comparison
if(myNum < 10) {} //number comparison
if(myNum == 0 && isDone) {} //logical AND
if(!isDone) {} //logical NOT
if(myNum == 0 || isDone) {} //logical OR
Accessing
//add
//subtract
//multiply
//divide
//modulo
//assignment
//equal to
//not equal to
//less than
//less or equal
//greater than
//greater or equal
//not
//and
//orActionscript 3.0 Syntax Cheat Sheet
Listening for an event
Instantiating Class Objects
Using Class Objects
OOP:
Classes
Handling an event with an
event callback function
Creating Functions:
simplest (no parameters)
Calling Functions
with parameters and return
function onEventHandled(e:EventType):returnType {
//function content
}
package {
public class ClassName {
public var property:DataType;
public function ClassName(param1:DataType, ...) {
//Code here runs when a new object of this class is instantiated.
}
public function MethodName(param1:DataType, ...) {}
}
}
package {
public class MathEngine {
public var sum:Number;
public function MathEngine() {
sum = 0;
}
public function AddNums(num1:Number, num2:Number):void {
sum = num1 + num2;
}
}
}
DisplayObjectToListenTo.addEventListener(EventType.EVENT, onEventHandled);
stage.addEventListener(MouseEvent.CLICK, onMouseClicked);
function onMouseClicked(e:MouseEvent):void {
trace(e.stageX, e.stageY);
}
//will run whenever the event being listened
//for happens.
//Based on the type of event being listened for
//the event object returned may have special
//properties, such as mouse coordinates.
//Constructor (same name as Class)
//Public Method
//or
//Creates a new MathEngine Object (constructor runs here)
//Calls the AddNums method defined in the MathEngine class
//Accesses the sum parameter defined in the MathEngine class
//Public Property
//Class Name must match name of .as file EXACTLY
//causes the code defined in myFunction to run.
//addNums runs and is replaced with whatever value it returned.
function functionName(param1:DataType, param2:Datatype, ...):returnType {
return ValueOfReturnType;
}
functionName(param1:DataType, param2:Datatype, ...);
function addNums(num1:Number, num2:Number):Number{
var sum:Number = num1 + num2;
return sum;
}
var sum:Number = addNums(2, 4);
function functionName():returnType {
//function content
}
function myFunction():void{
trace(‘You just called myFunction’);
}
myFunction();
//return something unless the returnType is void
//remember that a function only runs when called
//the returnType is Number here, so we return
sum which is of type Number.
var varName:ClassName = new ClassName();
var ME:MathEngine = new MathEngine();
varName.MethodName(param1, ...); varName.ParameterName;
ME.AddNums(4, 5);
trace(ME.sum);
0/5000
จาก: -
เป็น: -
ผลลัพธ์ (ไทย) 1: [สำเนา]
คัดลอก!
ไวยากรณ์ Actionscript 3.0 โกงแผ่นประกาศตัวแปรการตั้งค่าของตัวแปรเรย์:สร้างกับการจัดการวัตถุ:สร้างและจัดการการเข้าถึงวนรอบย้ายรายการเอารายการออกแสดงรายการ:เพิ่มรายการตัวดำเนินการคณิตศาสตร์ Conditionals (ประเมินเป็น True หรือ False)var MyVar:Booleanvar MyVar:Boolean = truevar VariableName:DataTypeสีน้ำเงิน: AS3 สงวนคำแดง: คำแทน (กำหนดอะไรควรไป)สีดำ: คำ โดยไม่อ้างอิง AS3 หรือต้องจำรหัสการทำงานMyVar =จริงvar VariableName:DataType =ค่า VariableName =ค่าvar myArr:Array =อาร์เรย์ใหม่ ('item1', 2, myVar3);var myObj:Object = Object() ใหม่myObj.myParam = 'ของฉันค่า สร้างคุณสมบัติมาก ตามที่คุณต้องการสำหรับ (var i:int = 0 ฉัน < 10; i ++) { //value ของฉันเนื่อง: 0,1,2,3,4,5,6,7,8,9 }สำหรับ (ตัวเริ่มต้น เงื่อนไข เคาน์เตอร์) {//Loop อย่างต่อเนื่องจนกว่าเงื่อนไขเป็นเท็จwhile(condition) {//Loop ยังคงสภาพเป็นจริง และสิ้นสุดลงเมื่อเป็นเท็จ}var i:int = 0while(i < 10) {i ++ //Once ผมเพิ่ม 10 เงื่อนไขการวนซ้ำจะเป็นเท็จ}myObj.parameter ถ้าไม่มีพารามิเตอร์ กลับไม่ได้กำหนดvar myObj:Object = { myParam: 'myValue' }; เหมือนก่อนหน้าvar myArr:Array = ['item1', 2, myVar3]; เหมือนก่อนหน้าmyArr.push(4) ใส่ค่า 4 ในตอนท้ายของอาร์เรย์myArr.shift() เอารายการแรกจากอาร์เรย์ติดตาม (myArr [0]); ดัชนี 0 เป็นรายการแรกในอาร์เรย์เสมอติดตาม (myObj.myParam); เข้าถึงค่าของ myParam: 'ค่าของฉัน'ติดตาม (myArr [myArr.length-1]); เข้าถึงรายการสุดท้ายในอาร์เรย์ArrayName [ดัชนี]; แทนที่ โดยรายการในอาร์เรย์ที่ดัชนีนั้นประกาศแต่ไม่ได้เตรียมใช้งานตัวอย่างการประกาศแบบบูลีนประกาศ และประกาศ //alreadythis.addChild(MyMovieClip)this.removeChild(MyMovieClip)this.addChildAt (MyMovieClip, 0);this.swapChildren (MyChildClip1, MyChildClip2);this.setChildIndex (MyMovieClip, 2);this.swapChildrenAt (0, 1);MovieClipName.addChild(MovieClipNameToAdd)ParentClipName.removeChild(MovieClipNameToRemove)สมมติว่านี้เป็นคลา MovieClip หรือ บนเส้นเวลาจำได้ว่า แสดงรายการเพียงอาร์เรย์วัตถุที่ดัชนีลดลงอยู่เบื้องหลังสินค้าที่ดัชนีสูงขึ้นSwaps วัตถุที่ดัชนี 0 และ 1Swaps คลิปสองย้ายคลิปที่ 2 ดัชนีif(false) {//will รัน} i ++ เหมือนฉัน+= 1 เหมือนผม =ผม + 1+-*/%===!=<<=>>=!&&||เพิ่มและ decrementการคำนวณและการดำเนินงานi- เหมือนฉัน-= 1 เหมือนผม = i-1ฉัน = 10 * 10 100 ฉัน = 10/10 1 ฉัน 10% = 10 0ฉัน = Math.random() หมายเลขระหว่าง 0 ถึง 1ฉัน = Math.round(1.5) 2 คณิตศาสตร์ปกติปัดฉัน = Math.ceil(1.1) 2 ปัดเศษขึ้นเสมอฉัน = Math.floor(1.8) 1 ปัดเศษลงเสมอif(true) {//will รัน}if(isDone) {//if isDone เป็นจริง รหัสที่นี่จะทำงาน} if(!isLoaded) อื่น {//if นี้ลงไปไม่เป็นความจริง รหัสที่นี่จะทำงาน} อื่น {รหัส //otherwise ที่นี่จะทำงาน}ถ้า (myString == 'สวัสดี') {} //string เปรียบเทียบถ้าเปรียบเทียบ (myNum < 10) {} //numberถ้า (myNum == 0 & & isDone) //logical {}และif(!isDone) {} //logical ไม่ถ้า (myNum == 0 || isDone) //logical {} หรือการเข้าถึงเพิ่มลบคูณแบ่งmoduloกำหนดเท่ากับไม่เท่ากับน้อยกว่าน้อยกว่า หรือเท่ากับมากกว่ามากกว่า หรือเท่ากับไม่และorActionscript 3.0 ไวยากรณ์โกงแผ่นฟังเหตุการณ์Instantiating วัตถุคลาสใช้วัตถุคลาสOOP:ชั้นเรียนการจัดการเหตุการณ์ด้วยการฟังก์ชันการเรียกกลับเหตุการณ์สร้างฟังก์ชัน:ง่ายที่สุด (ไม่มีพารามิเตอร์)การเรียกฟังก์ชันพารามิเตอร์และเที่ยวกลับ{onEventHandled(e:EventType):returnType ฟังก์ชันเนื้อหาฟังก์ชัน}แพคเกจ{คลาสาธารณะ ClassName { var สาธารณะคุณสมบัติ: ชนิดข้อมูล ฟังก์ชันสาธารณะ ClassName (param1:DataType,...) { รหัสที่นี่เรียกใช้เมื่อสร้างวัตถุของคลาสนี้จะสร้างอินสแตนซ์ } ฟังก์ชันสาธารณะ MethodName (param1:DataType,...) {}}}แพคเกจ{คลาสาธารณะ MathEngine { var สาธารณะผลรวม: จำนวน ฟังก์ชันสาธารณะ MathEngine() { ผลรวม = 0 } ฟังก์ชันสาธารณะ AddNums(num1:Number, num2:Number):void { ผลรวม = num1 และ num2 }}}DisplayObjectToListenTo.addEventListener (EventType.EVENT, onEventHandled);stage.addEventListener (MouseEvent.CLICK, onMouseClicked);{onMouseClicked(e:MouseEvent):void ฟังก์ชันติดตาม (e.stageX, e.stageY);}จะเรียกใช้เมื่อเหตุการณ์การฟังการเกิดขึ้นขึ้นอยู่กับชนิดของเหตุการณ์การฟังสำหรับวัตถุเหตุการณ์การส่งคืนอาจพิเศษคุณสมบัติ เช่นพิกัดของเมาส์ตัวสร้าง (ชื่อเดียวกับคลาส)วิธีการสาธารณะหรือสร้างวัตถุ MathEngine ใหม่ (การเรียกใช้ตัวสร้างที่นี่)เรียกวิธีการ AddNums ที่กำหนดไว้ในคลา MathEngineการเข้าถึงพารามิเตอร์ผลที่กำหนดไว้ในคลา MathEngineทรัพย์สินของประชาชนชื่อคลาต้องตรงชื่อไฟล์.asทำให้รหัสที่กำหนดใน myFunction เพื่อเรียกใช้addNums ทำงาน และถูกแทนที่ ด้วยค่าอะไรก็ตามกลับ{functionName(param1:DataType, param2:Datatype,...):returnType ฟังก์ชันValueOfReturnType กลับ}functionName (param1:DataType, param2:Datatype,...);{addNums(num1:Number, num2:Number):Number ฟังก์ชันผลรวม: จำนวนของ var = num1 และ num2ส่งกลับผลรวม}ผลรวม: จำนวนของ var = addNums (2, 4);functionName ()ฟังก์ชัน: returnType {เนื้อหาฟังก์ชัน}ฟังก์ชัน myFunction (): {ยกเลิกติดตาม ('คุณเพียงเรียกว่า myFunction');}myFunction()กลับสิ่งที่ยกเว้น returnType เป็นโมฆะจำไว้ว่า ฟังก์ชันทำงานเฉพาะเมื่อเรียกreturnType อยู่หมายเลข เพื่อให้เรากลับผลรวมซึ่งเป็นเลขvar varName:ClassName = ClassName() ใหม่var ME:MathEngine = MathEngine() ใหม่varName.MethodName (param1,...); varName.ParameterNameME.AddNums (4, 5);trace(ME.sum)
การแปล กรุณารอสักครู่..
ผลลัพธ์ (ไทย) 2:[สำเนา]
คัดลอก!
Actionscript 3.0 Syntax Cheat Sheet
Declaring a variable
Setting a variable’s value
Arrays:
Creating
Manipulating
Objects:
Creating and Manipulating
Accessing
Loops
Moving Items
Removing Items
The Display List:
Adding Items
Operators Conditionals (Evaluations of True or False) Math
var MyVar:Boolean;
var MyVar:Boolean = true;
var VariableName:DataType;
Blue: AS3 Reserved Words Red: Words to replace (defines
what should go there)
Black: Words with no AS3 dependency or
caracters necessary for code to work
MyVar = true;
var VariableName:DataType = value; VariableName = value;
var myArr:Array = new Array(‘item1’, 2, myVar3);
var myObj:Object = new Object();
myObj.myParam = ‘my value’; //create as many properties as you want
for(var i:int = 0; i < 10; i++) { //value of i each iteration: 0,1,2,3,4,5,6,7,8,9 }
for(initializer; condition; counter) { //Loop continues until the condition is false
while(condition) { //Loop continues while the condition is true and ends when it is false }
var i:int = 0;
while(i < 10) {
i++ //Once i increments to 10 the loop condition will be false
}
myObj.parameter; //if the parameter does not exist it returns undefined
var myObj:Object = {myParam:‘myValue’}; //same as previous
var myArr:Array = [‘item1’, 2, myVar3]; //same as previous
myArr.push(4); //puts the value 4 on the end of the array
myArr.shift(); //removes the first item from the array
trace( myArr[0] ); //the 0 index is always the first item in the array
trace( myObj.myParam ); //access the value of myParam: ‘my value’
trace( myArr[ myArr.length-1 ] ); //access the last item in the array
ArrayName[index]; //replaced by the item in the array at that index
//declared but not initialized
//example of declaring a Boolean
//declare & set //already declared
this.addChild(MyMovieClip);
this.removeChild(MyMovieClip);
this.addChildAt(MyMovieClip, 0);
this.swapChildren(MyChildClip1, MyChildClip2);
this.setChildIndex(MyMovieClip, 2);
this.swapChildrenAt(0, 1);
MovieClipName.addChild(MovieClipNameToAdd);
ParentClipName.removeChild(MovieClipNameToRemove);
//assuming this is within a MovieClip class, or on the Timeline
//Remember that the Display List is just an Array
//Objects at a lower index are behind items at a higher index
//Swaps the objects at index 0 and 1
//Swaps the two child clips.
//Moves the clip to index 2
if(false){ //will not run } i++; //same as i += 1; //same as i = i+1;
+
-
*
/
%
=
==
!=
<
<=
>
>=
!
&&
||
increment and decrement
calculations and operations
i--; //same as i -= 1; //same as i = i-1;
i = 10*10; //100 i = 10/10; //1 i = 10%10; //0
i = Math.random(); //number between 0 and 1
i = Math.round(1.5); //2 normal math rounding
i = Math.ceil(1.1); //2 always rounds up
i = Math.floor(1.8); //1 always rounds down
if(true) { //will run }
if(isDone) { //if isDone is true
//code here will run
} else if(!isLoaded) { //if isLoaded is not true
//code here will run
} else { //otherwise code here will run }
if(myString == ‘Hello’) {} //string comparison
if(myNum < 10) {} //number comparison
if(myNum == 0 && isDone) {} //logical AND
if(!isDone) {} //logical NOT
if(myNum == 0 || isDone) {} //logical OR
Accessing
//add
//subtract
//multiply
//divide
//modulo
//assignment
//equal to
//not equal to
//less than
//less or equal
//greater than
//greater or equal
//not
//and
//orActionscript 3.0 Syntax Cheat Sheet
Listening for an event
Instantiating Class Objects
Using Class Objects
OOP:
Classes
Handling an event with an
event callback function
Creating Functions:
simplest (no parameters)
Calling Functions
with parameters and return
function onEventHandled(e:EventType):returnType {
//function content
}
package {
public class ClassName {
public var property:DataType;
public function ClassName(param1:DataType, ...) {
//Code here runs when a new object of this class is instantiated.
}
public function MethodName(param1:DataType, ...) {}
}
}
package {
public class MathEngine {
public var sum:Number;
public function MathEngine() {
sum = 0;
}
public function AddNums(num1:Number, num2:Number):void {
sum = num1 + num2;
}
}
}
DisplayObjectToListenTo.addEventListener(EventType.EVENT, onEventHandled);
stage.addEventListener(MouseEvent.CLICK, onMouseClicked);
function onMouseClicked(e:MouseEvent):void {
trace(e.stageX, e.stageY);
}
//will run whenever the event being listened
//for happens.
//Based on the type of event being listened for
//the event object returned may have special
//properties, such as mouse coordinates.
//Constructor (same name as Class)
//Public Method
//or
//Creates a new MathEngine Object (constructor runs here)
//Calls the AddNums method defined in the MathEngine class
//Accesses the sum parameter defined in the MathEngine class
//Public Property
//Class Name must match name of .as file EXACTLY
//causes the code defined in myFunction to run.
//addNums runs and is replaced with whatever value it returned.
function functionName(param1:DataType, param2:Datatype, ...):returnType {
return ValueOfReturnType;
}
functionName(param1:DataType, param2:Datatype, ...);
function addNums(num1:Number, num2:Number):Number{
var sum:Number = num1 + num2;
return sum;
}
var sum:Number = addNums(2, 4);
function functionName():returnType {
//function content
}
function myFunction():void{
trace(‘You just called myFunction’);
}
myFunction();
//return something unless the returnType is void
//remember that a function only runs when called
//the returnType is Number here, so we return
sum which is of type Number.
var varName:ClassName = new ClassName();
var ME:MathEngine = new MathEngine();
varName.MethodName(param1, ...); varName.ParameterName;
ME.AddNums(4, 5);
trace(ME.sum);
การแปล กรุณารอสักครู่..
ผลลัพธ์ (ไทย) 3:[สำเนา]
คัดลอก!
ActionScript 3.0 ไวยากรณ์โกงแผ่น

การประกาศตัวแปรอาร์เรย์ของตัวแปร : ค่า




จัดการสร้างวัตถุ : การสร้างและจัดการการเข้าถึง



เอาลูปย้ายรายการรายการรายการที่แสดง :


( ( เพิ่มรายการเงื่อนไขการประเมินของ true หรือ false ) คณิตศาสตร์
var myvar : บูลีน ;
var myvar : บูลีน = true ;
var variablename : ชนิดข้อมูล ;
: AS3 สงวนคำแดง : สีฟ้าคำแทน ( กำหนดว่าควรไปที่นั่น

) สีดำ : คำที่ไม่มีอ้างอิง AS3 หรือ
caracters ที่จําเป็นสําหรับรหัส

myvar = true ; var variablename : ค่าชนิดข้อมูลค่า variablename = = ; ;
var myarr : เรย์ใหม่ = array ( 'item1 ' , 2 , myvar3 ) ;
myobj วาร์ : วัตถุใหม่ = object() ;
myobj.myparam = ' ค่า ' ; / / สร้างเป็นสมบัติมากเท่าที่คุณต้องการ
( var ผม : int = 0 ; ฉัน < 10 ;ฉัน ) { / / ค่าของแต่ละซ้ำ : 0,1,2,3,4,5,6,7,8,9 }
( initializer ; สภาพ ; เคาน์เตอร์ ) { / / ห่วงต่อจนกว่าเงื่อนไขเป็นเท็จ
ในขณะที่ ( เงื่อนไข ) { / / ห่วงอย่างต่อเนื่องในขณะที่เงื่อนไขเป็นจริง และสิ้นสุดเมื่อมันวาร์เท็จ }
: int = 0 ;
ในขณะที่ ( ฉัน < 10 ) {
/ / เมื่อฉันเพิ่มขึ้น 10 วง เงื่อนไขจะเป็นเท็จ
}
myobj.parameter ;/ / ถ้าพารามิเตอร์ไม่มีผลตอบแทน undefined
var myobj : วัตถุ = { myparam : 'myvalue ' } ; / / เหมือนเดิม
var myarr : เรย์ = [ 'item1 ' , 2 , myvar3 ] ; / / เหมือนเดิม
myarr ดัน ( 4 ) ; / / ใส่ค่า 4 บน จุดสิ้นสุดของเรย์
myarr . shift() ; / / เอารายการแรกจากอาร์เรย์
ติดตาม ( myarr [ 0 ] ) ; / / 0 ดัชนีมักเป็นรายการแรกในอาร์เรย์
ติดตาม ( myobj.myparam )/ / การเข้าถึงคุณค่าของ myparam : ของฉัน ' คุณค่า '
ติดตาม ( myarr [ myarr.length-1 ] ) ; / / เข้าถึงรายการสุดท้ายในอาร์เรย์
arrayname [ ดัชนี ] ; / / แทนที่รายการในอาร์เรย์ที่ดัชนี
/ / ประกาศแต่ไม่สามารถใช้
/ / ตัวอย่างของตรรกะ
ประกาศ / / ประกาศ / / ประกาศแล้ว
&ชุดนี้ addchild ( mymovieclip ) ;
. removechild ( mymovieclip ) ;
. addchildat ( mymovieclip , 0 ) ;
.swapchildren ( mychildclip1 mychildclip2 , ) ;
. setchildindex ( mymovieclip , 2 ) ;
. swapchildrenat ( 0 , 1 ) ;
movieclipname . addchild ( movieclipnametoadd ) ;
parentclipname . removechild ( movieclipnametoremove ) ;
/ / สมมติว่านี่คือภายในมูฟวี่คลิปคลาสหรือบนเส้นเวลา
/ / จำได้ว่า รายการที่แสดงเป็นเพียงเรย์
/ / วัตถุที่ดัชนีลดลงอยู่เบื้องหลังรายการใน
ดัชนีสูงกว่า/ / การแลกเปลี่ยนวัตถุที่ดัชนี 0 และ 1
/ / แลกเปลี่ยนสองเด็กคลิป .
/ / ย้ายคลิปดัชนี 2
ถ้า ( เท็จ ) { / / จะไม่วิ่ง } ; / / เหมือนฉัน = 1 ; / / เหมือนฉัน = ชั้น 1 ;
-
*
/
%
=
= =
! ! =

> <

> < = =
! !


&& | | และการคำนวณและการเพิ่มลดลง

ผม . . . ; / / เหมือนฉัน = 1 ; / / เหมือนฉัน = i-1 ;
= 10 * 10 = 100 ; / / 10 / 10 ; / / 1 ชั้น 10 % = 10 ; / / 0
ฉัน = คณิตศาสตร์ random() ; / / เลขระหว่าง 0 และ 1
= คณิตศาสตร์รอบ ( 1.5 ) ; / / ปกติเลขปัดเศษ
= คณิตศาสตร์ ซีล ( 1.1 ) ; / / เสมอ 2 นัดขึ้น
= คณิตศาสตร์ ชั้น ( 1.8 ) ; / / 1 เสมอรอบลง
( ถ้าจริง ) { / / ถ้าจะวิ่ง }
( isdone ) { / / ถ้า isdone รหัส / / จริง

} ที่นี่จะวิ่งอีก ( ถ้า ! isloaded ) { / / ถ้า isloaded ไม่ใช่รหัส / / จริง
ที่นี่จะวิ่ง
} อื่น { / / ไม่งั้นรหัสที่นี่จะวิ่ง }
ถ้า ( mystring = = ' ฮัลโหล ' ) { } / / สายเปรียบเทียบ
ถ้า ( mynum < 10 ) { } / / จำนวนการเปรียบเทียบ
ถ้า ( mynum && isdone = = 0 ) { } / / ตรรกะและ
ถ้า ( ! isdone ) { } / / ตรรกะไม่ได้
ถ้า ( mynum = = 0 | | isdone ) { } / / ตรรกะหรือ

/ / การเพิ่ม / ลบ

/ / /
/ / คูณแบ่ง
/ /

/ / งานโมดูโล / / เท่ากับ
/

/ / ไม่เท่ากัน / น้อยกว่า
/ / น้อยกว่าหรือเท่ากับ มากกว่า

/ / / /

/ / / ไม่สูง /
/ / oractionscript 3.0 ไวยากรณ์ฟังเหตุการณ์โกงแผ่น

หรือเท่ากันinstantiating คลาสวัตถุใช้วัตถุชั้นเรียน



เรียน OOP : การจัดการเหตุการณ์ที่มีการสร้างฟังก์ชันจากฟังก์ชัน

เหตุการณ์ :
ง่าย ( ไม่มีพารามิเตอร์ )

เรียกฟังก์ชันที่มีพารามิเตอร์ฟังก์ชันและกลับ oneventhandled
( E : eventtype ) : returntype {

} / / ฟังก์ชั่นเนื้อหา {

แพคเกจห้องสาธารณะ ชื่อคลาส {
สาธารณะ var คุณสมบัติ : ชนิดข้อมูล ;
ฟังก์ชันสาธารณะชื่อคลาส ( param1 : ชนิดข้อมูล , . . . ) {
/ / โค้ดที่นี่ทำงานเมื่อวัตถุใหม่ของคลาสนี้คือ instantiated .
}
สาธารณะฟังก์ชัน methodname ( param1 : ชนิดข้อมูล , . . . ) { }
} {

}
แพคเกจเรียน mathengine สาธารณะ {
สาธารณะ var ผลรวม : หมายเลข ;
สาธารณะฟังก์ชัน mathengine() {

}
ผลรวม = 0 ; ฟังก์ชันสาธารณะ addnums ( num1 : หมายเลข num2 : หมายเลข ) : เป็นโมฆะ {

} ผลรวม = num1 num2 ;
}
}
displayobjecttolistento . addeventlistener ( eventtype.event oneventhandled ;
, ) เวทีaddeventlistener ( mouseevent.click onmouseclicked ฟังก์ชัน onmouseclicked , ) ;
( E : mouseevent ) : เป็นโมฆะ {
ติดตาม ( e.stagex e.stagey , ) ;
}
/ / จะเรียกใช้เมื่อเหตุการณ์เป็นฟัง
/ /
/ / เกิดอะไรขึ้น ตามประเภทของเหตุการณ์การฟัง
/ / เหตุการณ์วัตถุกลับมาอาจ มีคุณสมบัติ
/ / พิเศษ เช่น พิกัดเมาส์
/ / ผู้สร้าง ( ชื่อเดียวกับคลาส )
/ /

/ / หรือแบบสาธารณะ/ / สร้างวัตถุใหม่ ( mathengine คอนสตรัครันนี่ )
/ / โทร addnums วิธีที่กําหนดไว้ใน mathengine คลาส
/ / เข้าถึงผลรวมค่ากำหนดใน mathengine คลาส
/ /
/ / ชั้นชื่อสาธารณะ จะต้องตรงกับชื่อของ เป็นแฟ้มตรง
/ / สาเหตุรหัสที่กำหนดไว้ใน myfunction เพื่อวิ่ง . . .
/ / addnums วิ่ง และจะถูกแทนที่ด้วยสิ่งที่มีค่ามันกลับ ฟังก์ชั่น functionname param1 : ชนิดข้อมูล (
,param2 : ชนิดข้อมูล , . . . ) : returntype {

}
functionname กลับ valueofreturntype ; ( param1 : ชนิดข้อมูลชนิดข้อมูล param2 : , , , . . . ) ;
addnums ( num1 ฟังก์ชัน : หมายเลข num2 : เลขที่ ) : หมายเลข {
var ผลรวม : หมายเลข = num1 num2 ;
กลับผลรวม ;
}
var ผลรวม : หมายเลข = addnums ( 2 , 4 ) ;
ฟังก์ชัน functionname() : returntype {

} / / ฟังก์ชั่นเนื้อหาฟังก์ชันโมฆะ {

myfunction() : ติดตาม ( เธอเพิ่งโทรมา myfunction ' ) ; } myfunction()


;/ / กลับมาอะไรนอกจาก returntype เป็นโมฆะ
/ / จำได้ว่า ฟังก์ชั่น วิ่งเฉพาะเมื่อเรียก
/ / returntype หมายเลขที่นี่ ดังนั้นเราซึ่งเป็นประเภทผลรวมกลับ

ตัวเลข varname : ชื่อคลาสใหม่ = classname() ;
วาร์มา : mathengine ใหม่ = mathengine() ;
varname methodname ( param1 . . . . . . ) varname . parametername ;
ฉัน addnums ( 4 , 5 ) ;
ติดตาม ( ฉัน ผลรวม )
การแปล กรุณารอสักครู่..
 
ภาษาอื่น ๆ
การสนับสนุนเครื่องมือแปลภาษา: กรีก, กันนาดา, กาลิเชียน, คลิงออน, คอร์สิกา, คาซัค, คาตาลัน, คินยารวันดา, คีร์กิซ, คุชราต, จอร์เจีย, จีน, จีนดั้งเดิม, ชวา, ชิเชวา, ซามัว, ซีบัวโน, ซุนดา, ซูลู, ญี่ปุ่น, ดัตช์, ตรวจหาภาษา, ตุรกี, ทมิฬ, ทาจิก, ทาทาร์, นอร์เวย์, บอสเนีย, บัลแกเรีย, บาสก์, ปัญจาป, ฝรั่งเศส, พาชตู, ฟริเชียน, ฟินแลนด์, ฟิลิปปินส์, ภาษาอินโดนีเซี, มองโกเลีย, มัลทีส, มาซีโดเนีย, มาราฐี, มาลากาซี, มาลายาลัม, มาเลย์, ม้ง, ยิดดิช, ยูเครน, รัสเซีย, ละติน, ลักเซมเบิร์ก, ลัตเวีย, ลาว, ลิทัวเนีย, สวาฮิลี, สวีเดน, สิงหล, สินธี, สเปน, สโลวัก, สโลวีเนีย, อังกฤษ, อัมฮาริก, อาร์เซอร์ไบจัน, อาร์เมเนีย, อาหรับ, อิกโบ, อิตาลี, อุยกูร์, อุสเบกิสถาน, อูรดู, ฮังการี, ฮัวซา, ฮาวาย, ฮินดี, ฮีบรู, เกลิกสกอต, เกาหลี, เขมร, เคิร์ด, เช็ก, เซอร์เบียน, เซโซโท, เดนมาร์ก, เตลูกู, เติร์กเมน, เนปาล, เบงกอล, เบลารุส, เปอร์เซีย, เมารี, เมียนมา (พม่า), เยอรมัน, เวลส์, เวียดนาม, เอสเปอแรนโต, เอสโทเนีย, เฮติครีโอล, แอฟริกา, แอลเบเนีย, โคซา, โครเอเชีย, โชนา, โซมาลี, โปรตุเกส, โปแลนด์, โยรูบา, โรมาเนีย, โอเดีย (โอริยา), ไทย, ไอซ์แลนด์, ไอร์แลนด์, การแปลภาษา.

Copyright ©2025 I Love Translation. All reserved.

E-mail: