??????????????????????? ActionScripts - PowerPoint PPT Presentation

1 / 47
About This Presentation
Title:

??????????????????????? ActionScripts

Description:

... ActionScript ActionScript 2 ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 48
Provided by: nun107
Category:

less

Transcript and Presenter's Notes

Title: ??????????????????????? ActionScripts


1
????? 7 _???
  • ??????????????????????? ActionScripts

2
?????????????????????
  • ??????????????????????????????????????????????????
    ????????????????????????? ??????????? 3 ??????
    ??????
  • if
  • ifelse
  • switch

3
?????? if
  • ???????????????????????????????????????? if
    ??????????????? true ?????????????????????????????
    ?????????????????
  • if(condition) if(condition) statement
  • statement(s)

??????
4
?????? if
if(condition)
false
true
statement
end
5
?????????????? if
  • var my_xtrue
  • if(my_xtrue)
  • trace(hello world)
  • //??????????????????????
  • if(my_xtrue) trace(hello world)

6
???????????????? if
7
?????? ifelse
  • if(condition)
  • statement(s)
  • else
  • else statement

??????
8
?????? ifelse
if(condition)
false
true
else
statement
end
else statement
9
?????????????? ifelse
  • var my_xfalse
  • if(my_xtrue)
  • trace("condition is true")
  • else
  • trace("condition is false")

10
???????????????? ifelse
11
?????????????? ifelse
  • ????????? ?????????????????????? if
    ??????????????????????????????????
  • if(condition)
  • statement(s)
  • else if(condition)
  • statement(s)
  • else

??????
12
?????????????? ifelse
  • var my_x30
  • if(my_x10)
  • trace(my_x)
  • else if(my_x20)
  • trace(my_x)
  • else if(my_x30)
  • trace(my_x)
  • else if(my_x40)
  • trace(my_x)

13
???????????????? ifelse
14
?????? switch
  • ??????????????????????????????????????????????????
    ????????????????????? ????????????????
  • expression ??? ???????????????????????
  • Clause ??? ?????????????????????????
  • statement(s) ??? ????????????????????

15
?????? switch
??????
switch(expression) case Clause
statement(s) break default statemen
t(s)
16
?????????????? switch
  • switch(2)
  • case 1
  • trace("A")
  • break
  • case 2
  • trace("B")
  • break
  • default
  • trace("D")

17
???????????????? switch
18
???????????????????
  • ???????????????????????? ?????????????????????????
    ??????????? ??????????????????????????????????????
    ??????? ??????????? 3 ?????? ??????
  • while
  • do while
  • for

19
?????? while
  • ????????????????????????? ????????????????????????
    ??????????????????????????????
  • while(condition)
  • statement(s)

??????
20
?????? while
while(condition)
false
true
statement(s)
true
false
end
21
?????????????? while
  • var i0
  • while(ilt5)
  • trace(i)
  • i

22
???????????????? while
23
?????? do while
  • ???????????????????????????????????????????
    ?????????????????????????? ???????????????????????
    ??????????????????????????????????????????????? 1
    ???
  • do
  • statement(s)
  • while(condition)

??????
24
?????? do while
do
statement(s)
while(condition)
true
false
end
25
???????? ?????? do while
  • trace("loop 1")
  • var i0
  • do
  • trace(i)
  • i
  • while(ilt3)
  • trace("loop 2")
  • var j10
  • do
  • trace(j)
  • j
  • while(jlt3)

26
????????????? do while
27
?????? for
  • ??????????????????????????????????????????????????
  • for(init expressionconditionupdate expression)
  • statement(s)

??????
28
?????? for
for
true
statement
false
end
29
?????????????? for
  • var iNumber
  • for(i1ilt3i)
  • trace(i)
  • trace("out of loop"i)

30
???????????????? for
31
?????????????????
  • ???????????????????????? ??? ?????????????????????
    ???????? ?????????????????????????
  • ?????
  • ????????????????????????????????????
  • ?????????????????????????????????????????????????
  • ??????????????????????????????????????????????????
    ??????? ????????????????

32
????????????????? ActionScript
  • ????????????????? ActionScript ???????? 2 ??????
    ???
  • ?????????????????????????? (User-defined)
  • ??????????? ActionScript ???????????????
    (predefined functions)

33
???????????????????????????????
  • function name(param1,param2paramN)
  • statement(s)

??????
34
??????????????????????????????????
  • function my_AreaCircle(radius)
  • var my_answerMath.PIradiusradius
  • trace(my_answer)

35
??????????????????????????????????
  • ?????????????????????????????????????
  • my_AreaCircle(20)

36
?????????????????????????????????
37
????????????????????
  • ?????????????????????????????????????????????
    ?????????????????? return ???????????????????
  • function box(height,wide,long)
  • return heightwidelong

38
????????????????????
  • ?????????????????????????????????????
  • allAreabox(4,5,6)
  • trace(allArea)

39
?????????????????????????????????
40
???????????????????????????????????????
  • ?????????????????????????? ActionScript
    ???????????????????? ?????????????????????????????
    ???? ????????????????????????????????????????
    ??????????????????????????????????
    ?????????????????????????????????? trace()

41
???????????????????????????????
  • typeof(expression)

??????
42
???????????????????????????????
  • var x100
  • var y
  • trace(typeof(3))
  • trace(typeof("3"))
  • trace(typeof(Math.PI))
  • trace(typeof(my_ball))
  • trace(typeof(x))
  • trace(typeof(y))

43
???????
44
???????????????????????????????????????
  • type(expression)
  • ???? String(expression)
  • Number(expression)
  • Boolean(expression)
  • Object(expression)
  • Array(expression)

??????
45
???????????????????????????????????????

var my_mcMovieClip var my_arrArray var
my_boolBoolean var my_numNumber var
my_objObject var my_strString
46
???????????????????????????????????????
  • trace("type MovieClip"(typeof
    MovieClip(my_str)))
  • trace("type object"(typeof Object(my_str)))
  • trace("type Array"(typeof Array(my_num)))
  • trace("type Boolean"(typeof Boolean(my_mc)))
  • trace("type String"(typeof String(my_mc)))
  • trace("type Number"(typeof Number(my_obj)))
  • trace("type function"(typeof Function(my_mc)))
  • trace("type null"(typeof null(my_arr)))
  • trace("type undefined"(typeof
    undefined(my_obj)))

47
???????????????????????????????????????
Write a Comment
User Comments (0)
About PowerShow.com