Flash Study Notes (1)

Source: Internet
Author: User
Tags case statement

The enumerated variable for... in is the subscript in the array.

For each .. In traverses elements in the array.

 

VaR books: Object = {"hello", "Judy", "Wong", "Star" };< br/> for (var k in books) {<br/> trace (Books [k]); <br/>}< br/> for each (VAR m in books) {<br/> trace (m ); <br/>} 

Simple judgment

 

 

Which is a little different from the switch statement in Java?

The case statement in the swtich () statement can be of the string type...

 

 

Ii. Function Learning

 

As functions are divided into two types: method and function closure ).

 

 

Function Name (parameter 1: parameter type, parameter 2: parameter type): return value {

// Internal function statements.

}

 

Different Java

Public Return Value Function Name (parameter type: parameter 1, parameter type: parameter 2 ){

}

 

 

In flash

 

1. functions can proxy function objects.

 

 

VaR kfunc: function; <br/> var sex: String = "man"; </P> <p> If (sex = "man ") {<br/> kfunc = manfunc; // equivalent to the address at which kfunc points to manfunc. <Br/>}< br/> funtion manfunc (): void {<br/>} 

 

This method is available in C and C ++ and seems to have been useful in Java.

 

 

2. Create a function queue

VaR F: array = new array (); <br/> F. push (afunc); <br/> F. push (bfunc); <br/> F. push (cfunc); <br/> function afunc () {<br/>}< br/> function bfunc () {<br/>}< br/> fuction cfunc () {<br/>}< br/> 

 

3. Flash = good judgment

 

Whether you use = for the address or content, the difference with Java is that you use the equeas () method to compare the content in Java.

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.