224 60 6MB
Russian Pages 405 Year 2009
. 1995
Macromedia Director Lingo, Internet. 1996 Ventana "The Comprehensive Guide to Lingo" (" Lingo"), "The Director 6 Book". 1999 "Que" "Special Edition Using Director 7" (" Director 7"), "Special Edition Using Director 8" (" Director 8") 8.5. "Macromedia Flash 5 for fun and Games" "Sams Teach Yourself ActionScript in 24 Hours". Macromedia . , . (Debby) (http://www.atticbookstore.com/). , , (Lucy) (Natasha).
«Special Edition Director 7» (« . . , :" ." , : " , ?
Director 7») , .
, -
,
, ,
!" ,
,
.
. .
, CleverMedia. (Jerry),
(Jacqueline) ,
Atari. (Larry)
,
,
,
. ,
(Rebecca Jacob), . ,
.
(Barbara)
(Richard Shifrin), Risk. (William Follet), (Jay Shaffer) – , ,
(Brian Robbins) CleverMedia.
, . , (Tage) (Andrea Thomsen)
(Anne Thomsen),
,
. (Candy Hall),
"Que", (Laura Norman),
: (Tom Hayes),
(Tonya Simpson), (Doug Scamahorn), Hunter), (Trina Warst), Follet).
(Margo Catts), (Cindy Teeters), (Anne Jones)
(Chris Barrick), (Michael (William
! –
–
. ,
,
, ,
. : Que: [email protected] : [email protected] , Web-
www.quepublishing.com. ,
Que, )
ISBN ( .
«Macromedia Flash ActionScript for Fun & Games» («Macromedia ActionScript»). , 12 . ActionScript, . Action-Script, . ,
Flash. ,
, .
Flash 8. Flash MX, ActionScript.
, Flash 8,
Flash MX ,
Web, Flash 8 .
Flash, .
– Flash 8
, .
,
, . , .
. ,
5-
16- ,
,
,
. ,
"
Flash 8.
-
,
7
"
Flash 8
. ,
,
8,
MX.
-
Flash
«
»,
.
Flash
, .
Web-
ActionScript –
Flash,
.
–
Flash.
1" Flash,
Flash,
" , .
ActionScript"
Flash, , ActionScript. "
. , 3" ActionScript
2"
ActionScript ,
.
, 4"
.
"
. , .
",
, -
7"
,
5"
", "
,
,
"
"", 9 "
14 "
. "", 10 "
"
"", 11 "
6" 8 " " ", 13 "
", 12 " ", 15 "
"
16 "
",
"
. 5-16
, .
. ,
. .
. , 17- ,
"
"
,
, .
Web-
"
,
, Internet
Flash". ,
ActionScript! 37 http://www.dmk-press.ru.
,
,
Flash.
,
ActionScript, .
-
.
,
, ,
. ,
-
,
.
-
. , Flash,
, Web. ActionScript
. . Internet,
,
,
.
,
Flash
.
,
ActionScript.
,
. .
-
,
,
Flash Flash 8,
. ,
,
,
.
,
,
: Java, C++
Lingo. ActionScript
Flash. 1–3;
,
5. ,
Flash 3
Flash 4
,
Flash 3 Flash 8.
,
Flash 4 Flash 8 ,
Flash MX . Flash MX, ,
, .
Web,
, . .
Flash 8 , . Flash
, 1
4.
. WebWebHTML, . .
Dreamwaver
,
, JavaScript, Perl,
Photoshop, Fireworks, ,
Flash Web-
-
,
. .
. , ,
,
. .
Flash Flash
. . ActionScript. Flash,
,
.
, .
Flash, Flash 8 ActionScript. Flash , . .
, . , Flash Flash, ,
.
Flash
, ,
. :
•
Flash
; Flash 8; ,
;
,
. Flash. , ,
, , Flash.
– ,
, ActionScript.
Flash,
,
, ,
:
? ActionScript ,
–
ActionScript.
, ActionScript , .
. , ,
, . Flash
,
, .
ActionScript, .
.
4
, .
,
, .
Web-
,
,
, . ,
, ,
ActionScript.
,
16
.
,
, ,
1-15. 4 .
,
,
.
Web, . – ,
Flash,
,
– . , : http://www.dmkpress.ru.
,
, . . ,
:
: Example.fla , , .
. ,
, ActionScript. : gotoAndPlay(), stop(), _x.
Flash.
,
, ,
myVariable. . ,
,
,
,
: //.
, ,
. ,
. ,
.
. ,
,
. . ,
,
("").
. , .
. ,
,
. , .
, Flash
Action-Script, .
, : http://www.garyrosenzweig.com/books/books9support.html , ,
,
, .
-
, Web-
,
.
,
. , ,
,
– ,
.
,
, Action-Script
(
.
1 Flash, • • • • • •
Flash
Flash
,
Flash,
,
).
,
,
Flash
. Flash 8
,
ActionScript. – ,
.
Flash Flash,
ActionScript, ,
Flash
.
Flash
–
. 1.1
.
,
,
.
–
1.1.
Flash
ActionScript
,
.
, 1, 5, 10
15.
.
: «Background» (
)
«Fox» (
,
). ,
.
, Frame view (
),
. 1.1. ,
(
).
. :
, ,
. , Scale (
. ),
,
"
"
.
Cntrl+2(PC)
Command+2(Mac)
,
. Cntr+3
, , .
, Cntr+1 (Command+1)
,
, Command+3 , 100 %.
,
+
–
. ,
,–
/
Lock/Unlock (
/
Show/Hide (
)
).
, . ,
.
Flash
, .
. ,
. .
, . 1.2 ( Swatches
, ), Components (
Color Mixer ( Answers (
)
).
. , ), Color Swatches Color
.
1.2. Э , , ,
. «
» , , →
. . Window → Panel Sets → Default Layout ( ).
→
, . ,
. ,
-
.
Layout. Panel Sets.
Info, . (X
Y),
, Window → Save Panel Window →
Window → Info, , (W H).
Transform (
Window → Transform. .
. 1.3)
Transform
1.3.
, Properties (
ActionScript, –
).
(
. 1.4) ,
:
. .
,
. ,
.
Properties
1.4. Properties (
)
(
,
.
,
, .
(
?
,
. 1.5
, ,
. ,
, -
)
,
, «labels»).
,
Library ( ,
,
,
ActionScript, ). .
Library
1.5.
,
Library
,
. .
,
,
,
,
.
,
. : 1,
.
,
, .
,
, . , .
,
, .
. swf-
,
. , ? Flash
,
. Flash ,
Symbol Linkage
Properties (
)– Options (
Library (
. 1.6.
),
. 1.5).
1 «Simbol» , .
.
.
.
«
, »
. «
»
,
, .–
Symbol Properties
1.6.
, Action Script
, .
. ActionScript,
, . File File ( ) Windows. )
Macintosh (
, ), Save ( Import (
Open (
)
Save As
),
, File Command+S (Macintosh)
.
Save, Ctrl+S (Windows).
. ,
,
. , Flash
, .
Macromedia
, Flash. .
,
, .
File
Publish (
)
Publish Settings
(
).
. Edit
Paste (
Edit ( ).
)
: Copy ( Undo (
)
100
)
,
,
Edit → Preferences (
,
→
), Cut ( .
). Preferences
,
. 1.7.
, ,
. ,
. Expert
(
, , Normal ( ) ActionScript
), .
Preferences,
1.7. ,
View View (
) , . , ActionScript, .
Grid ( → ,
View → Grid → Edit Grid ( , . , Show Grid (
. 1.8, ).
)
Snap To Grid (
).
), → Grid
Grid
1.8. View
Hide Panels (
), .
Tools (
,
),
.
,
,
,
,
. Insert Insert (
) –
ActionScript.
, Convert to Symbol (
), ,
.
, . (
Symbol Properties ( . 1.9).
),
1.9. Symbol Properties Insert → Convert to Symbol. Э
,
Convert to Symbol
, .
, ,
. Convert to Symbol
, ,
,
.
Insert → Frame (
,
,
.
→
,
Insert
).
Insert → Keyframe (
→
)
Insert → Blank Keyframe (
→
). –
),
, Insert → Remove Frames ( → , Insert → Clear Keyframe ( , . ,
, . )
→
Flash. .
–
.
,
. :
–
, . .
,
,
, , ,
,
. ,
Flash 8.
Modify Modify Modify → Document Document Properties ( .
. (
1.10).
)
,
Document Properties
1.10.
Transform (
).
, . ,
ActionScript,
ActionScript,
. Group (
). ,
.
,
,
, ,
, , ,
, , ,
,
. , . Flash 8. Text
Text
(
). . Control Control (
(
)
Test Movie
). Command+Return (Macintosh) swf-
, Ctrl+Enter (Windows),
. , Flash (
Web)
.
Play ActionScript, ,
Control, Play .
. Test Movie
Window Window (
)
,
. :
Reference (
) ActionScript
ActionScript
Flash. ,
Flash. .
Flash
:
ActionScript.
,
.
Action-Script ,
( → ) Insert → Convert to Symbol (
,
,
Insert → New Symbol
: →
.
).
New Symbol , , Library.
Library. , ,
Flash, Flash
, Down, Over
,
: Up,
Hit. . ,
. 1.11.
: • Up – • Over – • Down – • Hit –
; ,
; ,
, .
,
,
1.11.
Over
;
Down. Down
,
Up.
-
Over
,
-
.
. ,
Up. ,
Up
.
Hit
, Hit
Over
Down
. ;
.
.
Up. Hit
, Hit
,
. . , ,
Hit
Up, Over Flash
.
-
Down
.
.
,
.
, ,
, .
.
: Samplebuttons.fla .
. 1.11
. Rectangle ( ) Insert → Convert to Symbol. Samplebuttons.fla .
WebRectangle.
, .
2.
,
–
. ,
"PRESS ME!" ( , . 1.11.
Text (
)
!). ,
"My Button" (
). . , .
Flash
,
,
Up,
.
, .
Hit
. , . F6 ( Hit
).
Over
Down
.
. ,
.
Flash
. , ActionScript, – . ActionScript.
,
,– ,
Properties
(
. 1.12). . 1.12. Text.
Properties. Dynamic Text Input
Static Text;
1.12.
Properies
,
Dynamic Text ( . 1.13).
Properties
1.13.
,
Properties
(Single Line), (Multiline) (Multiline No Wrap). , Selectable ( ), Render Text as HTML ( HTML) Show Border Around ( ). HTML HTML, . Border . Selectable , . ActionScript Var ( ), . . . . , .
, Flash-
,
,
,
Flash
.
,
, ,
. Flash –
swf. ,
, Arial, .
Input Text (
). . 1.13. Single Line, Multiline Multiline No Wrap – Password ( ). , , , . Max Chars ( ), . 0 .
Properties Input Text
Flash
,
.
, . "
".
,
.
Flash Flash
,
,
. Flash ,
. ,
Adobe Photoshop
Sound Forge. ActionScript.
.
ActionScript. , .
. 1.14
File → Import ,
Flash
( → ). JPEG, GIF, PICT BMP.
. Flash, Bitmap Properties (
),
.
1.14.
Bitmap Properties
, Update (
) Modify → Trace Bitmap ( ,
→ . 1.15.
, ).
Trace Bitmap
1.15.
Trace Bitmap . , , .
,
.
-
,
,
, . Flash, Flash.
Adobe Streamline. , ,
Flash
.
,
. Flash AU
: AIFF, MP3, Sun
Wave. Flash, Sound Properties ( . 1.16.
)–
.
Sound Properties Flash-
1.16.
.
, .
(
,
, Sound
,
). Sound Properties . 16 / , /
, ,
MP3 , 64
. . 32
,
/ . ,
. , .
. 1.17
Properties
,
. ,
.
1.17.
Properties
,
,
ActionScript . , Flash
, , ,
ActionScript (
.
. , ActionScript Linkage Properties.
. 1.6).
,
Action Script, Flash-
.
. . .
Library.
, . ,
. 52 52
(
)
52
,
cards ( (
).
).
,
, . ,
Library New Folder (
).
(
). ,
ActionScript. Library , .
. 1.18 ( .
,
, .
. , Library. Date Modified),
Library
1.18.
, .
,
,
ActionScript.
К ActionScript .
,
Properties. ActionScript
, .
7
?
,
13,
8. 7, 13
,
, 1. 8,
8, 14
9,
. ,
. , .
, , ,
ActionScript, .
ActionScript
. .
. 1.19
1.19. ,
ActionScript
Layer Properties ( Outline ( ), . swf-
, Flash;
)–
.
. 1.20.
,
.
Layer Properties
1.20.
,
,
.
Flash. Flash-
. ,
, ,
. ,
. ,
.
.
( ), ActionScript
. 1.21
. .
1.21.
Scene
-
Scene ,
Flash, ActionScript,
,
.
.
,
. 1.1
,
.
. Flash Player
. ,
,
ActionScript. , ActionScript-
, . ! ,
, Flash Player,
. Flash ,
,
,
.
,
, ,
Web-
(
).
,
,
,
,
,
,
.
, ,
File → Publish ( ,
,
→
File → Publish Settings ( .
swf-
.
). , ),
→
,
:
•
–
,
,
; •
–
,
,
,
, .
,
.
,
; •
– ActionScript,
•
, ;
– ,
. ,
•
stop –
,
;
ActionScript stop() .
, stop(),
, .
. stop().
ActionScript, 2 «
ActionScript».
Publish Settings ( Formats ( GIF, JPEG PNG QuickTime Movie RealPlayer .
File → Publish ( . 1.22).
→
),
)
. , ActionScript
Flash 8.
Publish Settings
1.22. Flash
SWF HTMLswf-
. Flash Generate Size Report ( swf-
fh-
Projectors.
,
), ,
swf( . 1.23). ) Flash Output (Window → Output). FileName Report.txt ( FileName – , fla. .
Flash swf-
1.23.
Publish Settings
Omit Trace Actions ( ,
) trace
, Output.
, FlashProtect from Import (
. )
. .
Debugging Permitted (
) .
4"
". .
Override Sound Settings ( ,
) . Version (
)
, , Flash 1, 2, 3, 4, 5, MX 8. ActionScript ActionScript, Flash MX 8.
. , Flash 3? ,
. 8,
,
. Publish Settings, HTML-
,
. 1.24, swf-
.
HTML
1.24. HTML-
Publish Settings
,
swf2, .
HTML-
. 1.24,
swf.
,
Flash, swf-
, ,
HTML-
. swf-
Explorer,
.
,
Netscape. .
Web-
Internet
,
. 1.24.
Publish Settings, .
, HTML, Flash-
Sample.swf.
550x400 ,
,
–
, , Flash. –
.
2
,
Flash Alignment, ,
Flash MX,
.–
.
.
swf.
,
,
classid, codebase, IE
Internet Explorer. , Flash Plug-in ( , , . Netscape OBJECT, ActiveX – , Internet Explorer. Netscape Flash
Flash Internet Explorer Flash-
)
EMBED, .
Flash-
Flash,
, PLUGINSPAGE
.
TYPE
Netscape,
,
,
Flash. ! OBJECT
EMBED
Flash, Flash 8
.
, Flash 8,
,
Netscape
ActionScript. .
, "
Player". Flash,
Flash 8 JavaScript
, "Internet-
, Flash".
OBJECT . EMBED Internet Explorer . , EMBED
,
Internet Explorer . Flash-
,
EMBED. ,
. OBJECT, Internet Explorer
. :
,
, -
EMBED.
:
,
OBJECT,
–
,
. , ActionScript.
,
Flash
ActionScript, Action-Script.
2 ActionScript • • • • • • • • • • • • • •
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14.
ActionScript Actions ActionScript
ActionScript
ActionScript
:
,
Flash. ActionScript, .
24
ActionScript.
14 ActionScript.
"
10
1.
.
ActionScript
3 "
, ActionScript
ActionScript –
,
Flash MX.
,
,
ActionScript
. ,
,
ActionScript ,
,
. ActionScript
,
, ,
. ActionScript, – Flash 4,
Flash 8,
.
,
Flash,
, JavaScript – , HTMLInternet Explorer Web,
. Netscape.
Flash 8.
ActionScript, JavaScript.
,
ActionScript Flash
, Flash-
,
,
,
.
. ,
.
.
F9. Actions – Frame (
– .
). –
, ,
,
.
. . , –
, ,
.
. . .
,
F9
, ,
Actions.
,
,
.
Actions ,
Actions – Button ( .
,
–
).
. ,
,
. .
-
,
,
. .
. .
.
, Actions – Movie Clip (
–
Actions,
). .
,
,
.
,
. ,
,
.
2.
Actions
ActionScript . Flash 4.
: Actions ActionScript
Action-Script. ,
,
. . 2.1
Actions.
,
gotoAndPlay, . . Label (
. "My Frame Name".
)
Frame
.
Actions
2.1.
,
Actions. .
, .
Actions ,
.
, Properties (
. ), Actions (
, . 2.1)
Command+N
Command+E (Macintosh) ,
Ctrl+N
Ctrl+E (Windows). , .
. 2.2
Actions
. .
, .
Э
2.2.
. -
,
ActionScript ,
,
. ,
.
, . ,
.
,
. gotoAndPlay3.
3.
ActionScript
, Flash Output.
, – trace, Output
, Flash. .
Flash, ActionScript
, Flash
3
. ,
. .–
.
.
.
,
,
Flash-
. .
F9,
Actions. . Actions.
:
trace («Hello World!»);
,
trace – . .
trace.
Flash. – trace
, :
Output. . , . Frame.
, ,
, . trace.
– . 2.3.
Actions ActionScript
Actions –
2.3.
«Hello World» .
Web( swf(
Helloworld.fla →
). .
. 2.4).
. , . Output
Control → Test Movie Flash , "Hello World!"
trace
Output
2.4.
ActionScript. .
, "Hello
Flash
.
Flash
World" .
,
,
, Basic, Pascal, C, Java
ActionScript.
, .
4. 2 « ActionScript gotoAndPlay.
Actions» Flash , gotoAndPlay
Flash-
.
. Flash-
.
.
"part4".
"parti" ,
. ,
,
.
Gotoandplay.fla "PART 1" – "PART 4". "PART 2" – "part2" . . "PART 2".
"PART 1" . . ,
. 2.5
"parti",
, ,
, Actions
2.5. .
,
,
Actions.
: gotoAndPlay («part4»); ,
Action-Script " ". ActionScript
.
"parti"
"PART 1". "part2", "part4". «part4»,
Flash 4. 4
, .–
, .
.
.
ActionScript. "PART 2" «PART 4». ,
.
"parti"
"PART 1". ActionScript Flash . "part2", "part3" "part4", – "part2" "part3". ActionScript Flash. : Nonlinear.fla . . , . . 2.6 , , , .
2.6.
.
,
.
. ,
,
«parti»,
:
«part2»,
:
«part3»,
:
«part4»,
:
gotoAndPlay («part3»); , gotoAndPlay («part4»); , gotoAndPlay («part2»); , gotoAndPlay («part1»); Nonlinear.fla ActionScript
«part2», «PART 1» «PART 3». , «part2», «part4». «PART 1», «PART 3», «PART 2» «PART 4». ActionScript . gotoAndPlay
«PART 1». , «part3», : .
«part3».
,
-
,
, .
5. : Stop.fla ActionScript
.
,
, . , Flash. Flash . .
,
stop() .
. 2.7
Stop.fla.
, .
stop(). 1.
,
2.7. stop() . . .
. . . .
. 2.8.
.
2.8. ,
, stop(), . .
. . 2.8.
,
ActionScript
: on (press) { gotoAndStop("part1"); } . press.
-
on . gotoAndStop –
gotoAndPlay.
,
.
-
.
, . ,
. ,
"part 2", "part 3"
"part 4". : Navigation.fla , . . Navigation.fla. Flash-
.
"PART 1" – "PART 4", ,
, PowerPoint
.
Flash,
.
6.
ActionScript
: Animate.fla ActionScript. , . 5.
. Animate.fla -
. ,
,
. ,
.
, (
5
2.9).
« » (movie), movie clip. – .
. .
.
«
»
2.9. ,
-
, . onClipEvent,
on
, . : enterFrame.
12
, 6 .
/ ,
12
. on(press)
,
onClipEvent(enterFrame)
. ,
.
,
.
OnClipEvent(enterFrame) { 6
stop() ,
.–
.
.
, .
«
»,
this._x – ; } this._x –,
,
,
,
.
this this this _x . this._x ( 1(
,
.
,
.
,
. . .
–
). ).
,
this. _x –
1,
. ,
(
++, ).
,
+=
-=:
OnClipEvent(enterFrame) { this._x -= 5; } .
7. : Usercontrol.fla ,
. ,
.
_y .
,
,–
. _ymouse,
: _xmouse . :
? .
,
this._xmouse . . , _root.
,
this
_root._xmouse . _x
, _xmouse
_y
.
_ymouse
:
OnClipEvent(enterFrame) { this._x = _root._xmouse; this._y = _root._ymouse; } . 2.10 , .
«
» stop().
Usercontrol.fla. .
, .
2.10. ,
, ActionScript.
8. -
, .
,
,
5. 2,
7.
ActionScript: myVariable = 5; myVariable += 2; myVariable – Flash,
. . Flash ( ActionScript
-
). 5.
myVariable
2. 7.
myVariable
. .
,
,
,
,
, "userName".
,
,
.
.
–
«Hello World». =.
,
myVariable = «Hello World»; Flash , .
.
– ,
,
, ActionScript ,
,
.
, . , .
,
this
.
this
. , . , .
,
,
. ,
, .
,
, .
"var" ,
.
-
,
.
,
,
,
.
9. , ,
++
. .
+= .
,
. +, -, /
. ,
: .
b.
*.
a = 7; b = 5; c = a + b; 12. : c = a – b; c = a * b; c = a / b; 2
, 35 –
1,4 –
. , .
Flash. ,
Math, Math.sqrt
: a = 9; b = Math.sqrt(a); 3–
b
9. ,
,–
. .
Flash
Math.random(). 0.0
1.0.
,
, int.
,
0
9:
myRandomNumber = int(Math.random()*10); . .
,
+: a = «Hello»; b = "World"; c = a + b; «HelloWorld». . Flash «Hello World»: a = «Hello»; b = "World"; c = a + " " +b;
+=:
, .
a = «Hello»; b += "World"; , ActionScript
,
,
.
10. 5 «
»
, .
,
, ,
, ActionScript
,
. . ,
if. .
,
,
. ,
.
, .
.
if (a == 7) { GotoAndPlay("special frame"); } == ,
. .
,
.
.
if
, if
.
, .
else ,
if, -
: if (a == 7) { gotoAndPlay("special frame"); } else { gotoAndPlay("another frame"); } if
.
, ,
,
if {a == 7) { gotoAndPlay("special frame"); } else if (a == 12) { gotoAndPlay("very special frame"); } else if (a == 15) { gotoAndPlay(" extremely special frame"); } else { gotoAndPlay("a not so special frame"); }
. else.
== ,
. «Gary»,
username
,
: if (username == «Gary») { ==,
,
,
,
=
, .
, . ,
. username
,
,
: if ((a == 7) and (username == «Gary»)) { . or: if ((a == 7) or (username == «Gary»)) { if
. ,
,
,
. ,
.
11. ; –
. .
Flash
.
–
for. for:
. for(i=0;i newscale) { // . this._xscale -= 10; this._yscale -= 10; } else if (this._xscale < newscale) { // . this._xscale += 10; this._yscale += 10; } }
OnClipEvent on()
. , ,
mouseDown
, . , onClipEvent load, unload, mouseMove, mouseUp, keyDown, keyUp data.
100, .
newscale 100.
enterFrame , , newscale 150. enterFrame newscale. . _xscale
newscale
, enterFrame .
.
_xscale , ,
_xscale
_yscale 10.
150, .
, , newscale
100.
. ActionScript, .
_xscale _yscale 100 .
,
, .
К , on (release),
.
-
,
.
,
,
. 5.1. ActionScript.
,
. ,
,
. , . ,
,
#include, . .
,
#include .
,
Expandingbuttons.fla.
_xscale ,
_yscale
. . .
.
,
. newscale
,
100
. .
: Colorchange.fla, Colortransform.fla, Gradualchange.fla, Spiral.fla ActionScript , . . . .
– Color
, .
,
_rotation.
ActionScript .
, ,
,
,
. Color
Color ,
. . Color,
.
, :
myColorObject = new Color(«myMovieClipName»);
Color .
,
Color
, .
Color
.
.
–
. flash-
.
«myMovieClip». :
myColorObject = new Color(«myMovieClip»); trace(myColorObject.getRGB()).toString());
! , . ActionScript . .
Output, "0".
trace.
toString . ,
ActionScript, , trace.
, Properties Settings. 128
R,G
B.
128 0.
. Color Advanced Effect R, G B ( . 5.3)
, Advanced, .
Advanced Effect
5.3.
128
R, G
8421504, toString,
B. .
RGB,
.
myColorObject = new Color(«myMovieClip»); trace((myColorObject.getRGB()).toString(16));
new Color. .
,
.
new,
.
( 0
128, toString() , . : ,
, ,
808080, , 255).
16 .
RGB-
, setRGB.
,
. :
myColorObject = new Color(«myMovieClip»); myColorObject.setRGB(0xFF0000); ,
0x FF0000
. . .
Colorchange.fla,
setTransform() (
-100 %
100 %) rb, gb bb
Web-
Color. .
.
setTransform ra, ga
,
ba
,
. (
-255
255)
.
– aa ab . 5.3 (
-
_alpha ( ,
)
. ,
). -
.
.
: myColourTransform = {rb:255, bb:0, gb:0}; . :
,
,
ra, ga
. ba.
,
.
: myColor = new Color(«myMovieClip»); myColorTransform = {rb:255, bb:0, gb:0}; myColor.setTransform(myColorTransform); , .
Colortransform.fla setTransform . ,
, WebsetRGB , .
,
ActionScript,
.
,
,
. 0
255.
, . load.
n.
enterFrame
, n.
onClipEvent(load) { myColor = new Color(this); myColorTransform = {rb:255, bb:0, gb:0}; n = 0; } onClipEvent(enterFrame) { myColorTransform.rb = n; myColor.setTransform(myColorTransform); n++; }
++ n
. 7,
,
5.
n++ –.
,
n, 0
255.
255 Web-
. Gradualtransform.fla.
-
.
. ,
.
,
. setTransform, . ,
255,
: 1. 2. 3. 4. 5. 6.
0. 0.
,
255. 0. 255. 255. ,
(cyan),
,
,
,
(magenta), . .
.
–
.
.
,
–
.
, . ,
n,
. .
3,
,
,
. 1,
n .
6
c n
if (n == 1) { colorTransform.rb -= 5; if (colorTransform.rb ==0) n = 2; } else if (n == 2) { colorTransform.bb -= 5; if (colorTransform.bb ==0) n = 3; } else if (n == 3) { colorTransform.rb += 5; if (colorTransform.rb == 255) n = 4; } else if (n == 4) { colorTransform.gb -= 5; if (colorTransform.gb == 0) n = 5; } else if (n == 5) { colorTransform.bb += 5; if (colorTransform.bb == 255) n = 6; } else if (n == 6) { colorTransform.gb += 5;
if…then, .
n
if (colorTransform.gb == 255) n = 1; }
. n = n + 5. .
+= ,
5
n += 5 =-
n.
if.then.
n colorTransform ,
. .
n ActionScript
onClipEvent(load)
onClipEvent(enterFrame).
, .
,
, _rotation.
onClipEvent(load) { // spiralColor = new Color(this); colorTransform = {rb:255, bb:255, gb:255}; // n . n = 1; } onClipEvent(enterFrame) { // , if (n == 1) { colorTransform.rb -= 5; if (colorTransform.rb == 0) n = 2; } else if (n == 2) { colorTransform.bb -= 5; if (colorTransform. bb == 0) n = 3; } else if (n == 3) { colorTransform.rb += 5; if (colorTransform. rb == 255) n = 4; } else if (n == 4) { colorTransform.gb -= 5; if (colorTransform. gb == 0) n = 5; } else if (n == 5) { colorTransform.bb += 5; if (colorTransform.bb == 255) n = 6; } else if (n == 6) { colorTransform.gb += 5; if (colorTransform. gb == 255) n = 1; } // . spiralColor.setTransform(colorTransform); // . this._rotation += 5; }
.
.
.
this ,
. this ,
this,
,
, .
_rotation .
,
.
360°, Flash
.
,
370°
. 5.4
10°.
Spiral.fla.
5.4. , ActionScript
.
К Flash 8 – 120
.
/ .
, .
+=
–=
,
. ,
, .
Flash
: Randomlocation.fla, Randommovement.fla, Oldfilm.fla ,
,
.
ActionScript
, .
– -
.
,
«
»,
.
Flash MX
.
–
Random,
. 0
Flash
, Random(5) Flash MX Random 0,0 1,0.
499.
,
.
0 4. Math.random(). , . Math.random()
0,0 0
,
[0..1], , int
. 500,0.
Math.Random() 500 .
:
n = int(Math.random()*500); , 550x400. onClipEvent(load) { this._x = Math.random()*550; this._y = Math.random()*400; }
Randomlocation.fla, ,
Web-
.
,
. . .
dx
dy _x ).
_y
( dx
dy
onClipEvent(load) { dx = Math.random()*10-5; dy = Math.random()*10-5; } onClipEvent(enterFrame) { this._x += dx; this._y += dy;
-5 5 dx dy .
if (Math.random() > .9) { dx = Math.random()*10-5; dy = Math.random()*10-5; } } Randommovement.fla. . ,
.
Flash-
:
. .
,
, . ActionScript.
,
, .
,
-
,
.
. 5.5 ,
. .
,
.
,
5.5.
. .
Oldfilm.fla –
. : onClipEvent(load) {
.
wanderAmount = 300; leftLimit = 10; rightLimit = 540; chanceOfJump = 50; xPosition = 275; speed = 10; chanceOfChange = 0; } onClipEvent(enterFrame) { xPosition += speed; this._x = xPosition; chanceOfChange++; if ((Math.random()*wanderAmount < chanceOfChange or (xPosition < leftLimit) or (xPosition > rightLimit)) { speed = -speed; chanceOfChange = 0; } if (Math.random()*chanceOfJump == 1) { xPosition = Math.random()*(rightLimit-leftLimit)+leftLimit; } }
Flash : , 2x3+4
.
10. .
2x(3+4)
,
14.
.
leftLimit
.
rightLimit .
,
speed
.
. , xPosition, 10
speed. chanceOfChange 1,
300 ( .
150,
, 150
-
300
0,33 %), chanceOfChange 50 %.
,
.
.
chanceOfChange "
"
. speed
.
, . chanceOfJump . ,
. ,
.
.
5.6. Э
, Flash. ,
,
.
. ,
0%
100 %.
onClipEvent(load) { chanceOfAppearing = 10; chance = 0; } onClipEvent(enterFrame) { chance++; if (Random(chanceOfAppearing) < chance) { this._x = Randon(550); this._y = Random (400); chance = 0; } else { this._x =– 100; } }
.
,
.
.
К ,
,
. . ,
. .
Web-
.
,
,
, Web-
,
. ActionScript,
Flash-
,
.
, ,
.
,
. . , .
: Textfly.fla Flash-
. ,
,
Web-
.
,
,
,
. ,
. 5.7
,
. ,
Web.
.
,
5.7. Textfly.fla
ActionScript
Web.
.
,
:
, .
,
.
, . .
5.8.
, Properties letterText ( . 5.8).
" ". Dynamic Text
Properties
Dynamic Text Insert → Convert To Symbol.
,
letter0 ,
–
.
.
duplicateMovieClip . endx endy
.
endy, _y
Letter0,
.
endx
, 1.
(
0)
Letter0.
text = «Introducing: Flashy the Fox!»; for (i=0;i 0) duplicateMovieClip("Letter0","letter"+i,i); this["letter"+i].letterText = text.charAt(i); this["letter"+i].endx = this["LetterO"]._x + i*19; this["letter"+i].endy = this["LetterO"]._y; }
char At
,
.
0. ,
substr.
for
. .
for ,
. , ,
. .
,
for (i=0;i 12) { hour -= 12; } // . hourAngle = 360*hour/12; minuteAngle = 360*minute/60 secondAngle = 360*second/60; // . _root["hour hand"]._rotation = hourAngle; _root[ "minute hand"]._rotation = minuteAngle; _root[ "second hand"]._rotation = secondAngle; }
.
, 360.
, 0
0°
60,
1,
360°.
360, 12-,
24-
,
12. 0° ,0
,0
360°. 0°
.
0 (
12)
,
,
(
. 6.11).
,
_rotation,
.
(
6.11. 12:00:00.
), _rotation,
,
, ,
.
. 6.10 9,
9:59,
9 10:00
.
10. 10
10
.
, ,
.
:
// hourAngle += minute/2; minuteAngle += second/10;
.
2,
30°
.
10,
6 . 10:00
9*30 + 59/2 = 270 + 29.5 = 299.5.
: 9:59 10*30 + 0/2 = =
300 + 0 = 300. ,
20
= 120 + 5.9 = 125.9. . 6.12 . 6.10, ,
59
20*6 + 59/10 21*6 + 0/10 = 126 + 0 = 126. . .
,
6.12.
Betterclock.fla ,
,
. .
. . . , . .
, 15
.
: Lavalamp.fla . . Flash-
,
. , ,
.
, .
,
,
.
.
, ActionScript.
( 20 .
. 6.13), , ,
.
6.13.
«
»
,
Lava Lamp . 0 %.
alpha Mixer (
),
,
.
. 6.14
,
,
Fill ( .
)
Fill
6.14.
Lava Lamp .
.
20
Mixer
, attachMovie
attachMovie
5,
. ».
«
20
initLamp.
, .
,
,
-
. . attachMovie
duplicateMovieClip
.
. . ,
.
duplicateMovieClip
, . initLamp:
function initLamp () { // //
,
, Y.
top = 0; bottom = 300; // , numBubbles = 20; for (i=0; i= "A") and (keyChar = 0) and (phraseChar < 26)) { // letterNum = letterMap.charCodeAt(phraseChar)-65; // . userMap = replaceChar(userMap,letterNum,keyChar); // showPhrase(); // , . if (phrase.toUpperCase() == decrypted) { gotoAndStop("game over"); } } } } // . showCursor(); } ,
ActionScript, .
. ,
. // . function replaceChar(mainString, num, newchar) { newString
=
mainString.substring(0,num)+newchar+mainString.substring(num+1,mainString.length); return(newString); } ,
charpos, ,
.
TextFormat, . , plainFormat TextFormat . , encryptedText . ,
Flash
.
TextFormat , .
, decryptedText cursorFormat
. ,
. charpos.
, function showCursor() { // . plainFormat = new TextFormat(); plainFormat.bold = false; decryptedText.setTextFormat(plainFormat); encryptedText.setTextFormat(plainFormat); // . cursorFormat = new TextFormat(); cursorFormat.bold = true; decryptedText.setTextFormat(charpos,cursorFormat); encryptedText.setTextFormat(charpos,cursorFormat); }
К «game over». .
, removeListener,
.
,
, .
,
,
,
,
. LoadVariables swf.
, LoadVars.
,
13 • •
• • ,
, .
,
Web-
. .
-
– .
,
, . . .
: Jigsawpuzzle.fla "
"
,
,
,
. , ,
,
. 24 .
13.1.
. . WebJigsawpuzzle.fla.
. 13.1 ,
–
,
«
,
«actions», ,
».
. .
,
. ,
, Flash. ,
,
, ,
,
. ,
_alpha=75, ,
.
, , .
, .
,
, ,
, .
,
,
,
. ,
,
,
,
. (
. 13.2).
,
13.2.
,
. ,
, ,
. Jigsawpuzzle.fla.
, ,
,
.
. ,
. .
24
?
,
.
, .
,
,
. Flash-
,
,
. , ,
, 16. (
.
. 13.1).
Flash,
, (
). ,
,
. . ,
,
. ,
. .
24
24 ,
24
.
, 20
. .
,
,
. , ,
"0–0"
. 24
"5–3"
. .
_apha=75. "outline".
«actions», onClipEvent (mouseDown),
. .
, , . 16 Modify → Shape → Convert lines to Fills. –
,
.
.
.
,
Flash startDrag.
, .
startDrag – . ,
, ,
, stopDrag
. .
onClipEvent(mouseDown) { // . mx = _root._xmouse; my = _root._ymouse; // . for (x=0;x>$filename") || exit;
.
, ,
, ,
: 967&Gary&978887513.
# . print OUTFILE "$info{‘score’}&$info{‘name’}&$server_time\n"; Submitscore.pl
, Flash. OK.
# close(OUTFILE);
.
resultText
# print "resultText=OK\n"; # . exit;
.
Getscores.pl ,
,
Submitscore.pl.
. Submitscore.pl. " #!/usr/bin/perl # # . print "Content-type: text/html\n\n"; # , $filename = "highscore.txt"; # open(DATABASE,$filename) || exit; @score_text = ; close(DATABASE);
" @score_text.
,
. .
,
(
)
. # $server_time = time(); # , # (7 * 24 * 60 $keep_time = 7*(24*60*60);
. . * 60
)
. . # . open(DATABASE,">" . $filename) || exit; , .
,
# . foreach $score_line (@score_text) { # . @score_item = split(/&/,$score_line); # . $score_time = $score_item[2]; # , if ($score_time > ($server_time-$keep_time)) { print DATABASE "$score_line"; } } # .
.
.
close(DATABASE); . ,
,
. # . @score_text = sort { $b $a } @score_text;
.
. ,
,
: «1.Gary 967». :
. 18
,
.
–
,
, .
# , # $num_scores = 10; $score_count = 1; # print "highScoresText="; foreach $score_line (@score_text) { # @split_data = split("&",$score_line); # printf("%2i. ", $score_count); # , # 18 printf("%-18s ",$split_data[1]); # , # # . printf("%9i\n",$split_data[0]); $score_count++; if ($score_count > $num_scores) { last; } } # . exit;
.
.
. . , . ,
Flash Perl,
. , ,
-
:
Flash, .
: Highscores.fla Web-
, .
– Perl.
,
, . , Highscores.fla, ,
. 17.5.
.
17.5.
,
, ,
Perl
( (Courier).
17.5). ,
Ariel,
.
Highscores.fla
(
. 17.5). "
"
,
. , ).
,
on (press) { // submitscore.pl. url = "submitscore.pl"; // LoadVars. myLoadVars = new LoadVars(); myLoadVars.name = name; myLoadVars.score = score; // . returnedVars = new LoadVars(); myLoadVars.sendAndLoad(url,returnedVars,"GET");
, Submit Score ( .
.
resultText = "Sending..."; // . returnedVars.onLoad = function() { resultText = "Done." } } -
LoadVars 12 , Perl, SendAndLoad GET.
, GET
. . .
Flash, ,
–
POST. ,
HTML,–
,
.
,
myLoadVars: name onLoad.
, resultText.
Get Scores (
)
score.
,
-
:
on (press) { // getscores.pl. url = "getscore.pl"; // . myLoadVars = new LoadVars(); myLoadVars.load(url); highScoresText = "Getting High Scores..."; // . myLoadVars.onLoad = function() { highscoresText = myLoadVars.highscoresText; } } ,
Getscores.pl
onLoad
,
highScoresText=. .
myLoadVars .
,
.
: Whackafoxwithscores.fla Whackafoxwithscores.fla. 8,
"
", . ,
.
"
"
, .
stop() ,
: //
getscores.pl.
url = "getscore.pl"; // . loadVariables (url,this); // , highScoresText = "Getting High Scores…"; stop(); (
.
highScoresText . 17.6).
«
17.6.
«actions»
, « Submit Score. . « ». .
»
», ,
, , , _root.score = score,
score
score . " " name
", ".
.
sendscores.name = ""; sendscores.score = score; stop(); . 17.7
«
«
» ,
».
, ,
Submit Score.
,
«
17.7.
»
, , Submit Score, on (press) { // url = "submitscore.pl"; // // "score" – , // "name" – . loadVariables(url,this,"GET"); // , // . play(); }
. :
submitscore.pl. :
Submit
, Highscores.fla.
play(),
. Submit Score.
,
,
,
,
.
, . ,
, ,
.
, Web,
Flash?
. ,
,
. Perl,
. -
, ,
,
.
,
.
,
, .
,
,
, . . –
.
, .
.
–
, "
.
, 42
"
42 -
,
,
.
, . ,
. CGIC++.
Perl. ,
C
, PHP –
Flash: Version.fla ActionScript Flash 4 5 , Flash 5, . Flash MX Flash 8 , 8, . Flash MX, Flash 8, .
, , -
Flash MXFlash 8, .
.
,
К ,
,
. getVersion() ,
MAC
getVersion(). MAC 6,0 21,0. – .
WIN.
– Flash-
,
. .
,
,
, MAC 6,0 21,0
8? , .
-
getVersion() ,
.
–
,
.
function getVersionNumber() { // . spacePos = getVersion().indexOf(" "); firstComma = getVersion().indexOf(","); secondComma = getVersion().indexOf(",",firstComma+1); thirdComma = getVersion().indexOf(",",secondComma+1); lastChar = getVersion().length; // version. version = new Object(); version.platform = getVersion().substring(0,spacePos); version.n1 = getVersion().substring(spacePos+1,firstComma); version.n2 = getVersion().substring(firstComma+1,secondComma); version.n3 = getVersion().substring(secondComma+1,thirdComma); version.n4 = getVersion().substring(thirdComma+1,lastChar); return(version); } :
getVersionNumber {platform: MAC, n1: 6, n2: 0, n3: 21, n4: 0} , getVersionNumber(). n1.
Flash,
, .
,
,
. , ,
. , .
function requiredVersion(required) { version = getVersionNumber(); // false, if (version.n1 < required.n1) return(false); // true, if (version.n1 > required.n1) return(true); // , if (version.n2 < required.n2) return (false); if (version.n2 > required.n2) return (true); if (version.n3 < required.n3) return (false); if (version.n3 > required.n3) return (true); if (version.n4 < required.n4) return (false); if (version.n4 >= required.n4) return (true); }
. . .
:
if (requiredVersion) ({n1: 6, n2: 0, n3: 21, n4: 0}) { gotoAndPlay("start"); } else { gotoAndStop("version problem"); } ,
6.0.21.0,
,
,
. getVersionNumber Flash MX Flash 8.
requiredVersion , Flash MX-
Flash 8. , .
FlashFlash
6.0.42.0. . ,
.
,
,
, Macromedia
, ,
,
.
,
true
, .
, 5-
,
,
, 6.
,
,
.
7, Flash, Stockwave
true
7 ! JavaScript. ,
6, requiredVersion .
Flash 8Flash,
, . .
, ,
Flash 8
Windows. System.capabilities. ,
. .
// . capabilitiesDisplay = ""; for(i in System.capabilities) { capabilitiesDisplay += i+": "+System.capabilities[i] + newline; } Macintosh Powerbook: language: en-US input: point manufacturer: Macromedia Macintosh os: Mac OS 10.1.3
MAC
serverString: A=t&MP3=t&AE=t&VE=t&ACC=f&DEB=t&V=MAC%206%2C0%2C21%2C0&M=Macr omedia Macintosh&R=1152x768&DP=72&COL=color&AR=1&I=point&OS=Mac OS 10.1.3&L=en isDebugger: true version: MAC 6,0,21,0 hasAudio: true hasMP3: true hasAudioEncoder: true hasVideoEncoder: true screenResolutionX: 1152 screenResolutionY: 768 screenDPI: 72 screenColor: color , ,
System.capabilities,
.
,
System.capabilities
,
. , hasMP3 Flash 6-
.
,
,
,
hasMP3. ,
, .
System.capabilities System.capabilities screenResolutionX screenResolutionY,
, ,
,
,
, .
System.capabilities.os, ,
,
get.Version(), .
A Flash-
Internet ,
, Flash?
,
. , 22.
Flash-
FlashMacromedia, . :
(
,
, ,
),
. ,
22
, ,
.
Flash, –
,
, flasher.ru. ,
.–
.
.
.
Flash,
,
. http://developerdispatch.com/, ,
.
. Actionscript.com – http://www.actionscript.com/ Actionscripts.org – http://www.actionscripts.org/ Art's Flash Files – http://www.artswebsite.com/coolstuff/flash.htm Developer Dispatch – http://www.developerdispatch.com Flash 4 All – http://www.flash4all.de/ ( Flash Academy – http://www.enetserve.com/tutorials/ Flash Geek – http://www.flashgeek.com/ Flash Heaven – http://www.flashheaven.de/ ( Flash Kit – http://www.flashkit.com/ ( ) FlashMaestro – http://www.flashmaestro.fm/ ( ) Flash Magazine – http://www.flashmagazine.com/ Flash Pro – http://www.flashpro.nl/ Flazoom – http://www.flazoom.com/ Kirupa – http://www.kirupa.com/developer/ Colin Moock – http://www.moock.org/webdesign/flash/ Pro Flasher – http://www.proflasher.com/ Warp 9 – http://www.warp9.it/ ( ) We're Here Forums – http://www.were-here.com/
)
)
B • • • • • • •
«Senet» «Space War» "Space War" "Pong" "Pong" "Pac-Man"
,
.
,
,
, «Space War» (
1962 .
),
1970 . . ,
. . – ,–
, ,
, . ,
. . ,
, .
«Senet»
"Space War ,
.
,
,
,
,
.
Э , – «Senet» –
. 2000
. ,
.
,
,
. ,
.
«Senet»
B.1.
.
-
, ,
,
. "Senet"
,
,
.
,
,
. ),
(
,
,
,
,
, ,
.
,
,
«Nine Men's Morris». .
, .
, . .
, – –
"
"
,
" ,
.
,
.
. .
" ,
VI . . .
,
,
,
XV . ,
: XX .
.
,
, XIX – ,
.
XX . Milton Bradley
. ,
Parker Brothers, .
–
, "Scrabble"
"Monopoly" (
. Hoyle),
)– ,
(Edmund
, . ,
,
.
XX
,
-
;
,
,–
.
–
.
,
.
,
. ,
,
,
,
.
,
XIX . ,
, . . . . . .
, (H.G.Wells).
. , ,
60-
. 70-
XX
:
,
. ,
, . . .
,
,
"Dungeons & Dragons" , , , ,
. ,
. "Dungeons
-
&
Dragons"
,
. :
,
,
, ,
. ,
.
,
,
.
–
,
.
«Space War» 1962
«Pong»
(Steve Russel) (Massachusetts Insitute of Technology) . . . ,
PDP-1
,
–
. . , PDP-1
,
. :
PDP-1 ,
, . .
(
"Lunar Lander"
)
, ,
. ,
. ,
.
, "Adventure" (
.
),
. .
. "
"
, "
". ,
-
,
,
"Pong". .
.
«Pong»
"Pac-Man (Nolan
Bushnell) «Computer Space».
«Space War», . 25
.
"Computer Space"
.
, ,
. ,
500
,
: Atari. Atari – .
,
"
Atari ,
«Computer Space». , .
"
«Pong», . Atari
Atari
"Pong" , Atari Atari .
. Sears.
1976
1975 "Breakout",
, ,
,
1979 ),
(Stiven Jobs), . "Space Invaders" (
Taito –
. Atari ).
"Asteroids" (
80-
B.2.
1979
,
1980
.,
, .
-
. , "
"Pac-Man" "
. ,
,
. ,
.
,
,
,
, 1982
, ,
. 1,5
, ,
.
20
,
.
1982 . 80-
– .
,
,
,
.
,
.
-
1960-
(Ralph Baer) .
(
). . Odyssey
Odyssey ( 12 , .
).
,
. , ,
,
. General Instruments
Corporation,
5 .
6 Coleco
,
Telstar. ,
Fairchild,
RCA,
Atari
Mattel,
. , .
Atari
.
12
200
.
1980-
B.3.
, . Sony, Xbox
– Play Station II Microsoft
.
N64
Nintendo. , .
-
,
.
Apple II
. , .
1980.
, ,
. . , .
, .
, .
80-
,
, .
. "Myst",
.
. , -
, 90-
.
-
,
"Phantasmagoria"
,
. .
,
"Doom",
– 3D-"
90-
"
-
, ,
.
Macromedia Flash
Shockwave
. , -
.
. ,
:
,
, ,–
. . . .
,
,
.
, ,
. Java.
Flash, Shockwave HTML
, , . 2002 .
,
Flash 8
. ,
, Macromedia
Flash.
,
,
,
,
:
Screen Play: The story of Video games George Sullivan Publisher: Frederick Warne & Co., Inc., New York, NY, Copyright 1983 . Joystick Nation by J.C. Herz Published by Little, Brown & Company Limited, 1997 . The World of Games Jack Botermans, Tony Burett, Pieter van Delft, Carla van Splunteren Published by Facts on File, Inc., New York and Oxford, 1987 . The Greatest Games of All Time Mathew J. Costello John Wiley & Sons, Inc., 1991 , .
.
Game Over: Preee Start to Continue David Sheff Random House, 1993 Nintendo.
.
Hackers: Heroes of the Computer Revolution Steven Levi Anchor Press, 1984 , 80-
XX
According to Hoyle Richard L. Frey Fawcett Columbine, 1956, 1965, 1970 . The Oxford History of Board Games David Parlett Oxford University Press, 1999 . Family Fun & Games Sterling Publishing Company, 1992 .
.
,
A Brief History of Home Video Games (An Online Book) Sam Hart, 1996–1999 http://newton.physics.Arizona.edu/~hart/vgh. ,
.