Professional Documents
Culture Documents
Action Script From Zero PDF
Action Script From Zero PDF
Micheal240001@yahoo.com
micheal_nabil@hotmail.com
/
.
.
:
.
.
.
.
:
Micheal240001@yahoo.com
" " .
..
.
Action script 2.0
Action script 2.0
.
:
:
ActionScript 2.0
:
Data and Data Types
:
Operators
:
Flow-Control Statements
:
Loop Structures
:
functions and methods
:
:
Using event handler methods
:
:
Mouse Location
: Move Clip Rotation
: Detecting Key presses
: Dates and Times
: Using Data
: Object-Oriented Programming
-:
: Xml
:
-:
:
:
Macromedia Flash MX 2004 Game Programming
:
Using Components
:
Create e-Learning
:
asp.net and php
:
:
: -:
Action script 2.0 and Action script 3.0
: Action script 2.0 Action
script 3.0
......................................................................................................................
..........................................................................................................................
.....................................................................................................................
............................................................................................................
............................................................................................................
...................................................................................................................
........................................................................................
..........................................................................................................
DATA AND DATA TYPES
....................................................................
..........................................................................................................
...................................................................................... OPERATORS
....................................................................................................................
) .............................................................................................................. Pre-Increment and Post-Increment (++
....................................................................................................
.......................................... FLOW- CONTROL STATEMENT
.......................................................................................................
........................................................................ LOOP STRUCTURES
The while Loop ..............................................................................................................................
Nested Loops ................................................................................................................................
............................................................................................ ZYXWZYXWZYXW
........................................................................................................
....................................................................................... FUNCTIONS AND METHODS
...................................................................................................
........................................................................................................
............................................................................
.................................................................................................
USING EVENT HANDLER METHODS ...............................................
....................................................................................................................................
............................................................................................................
.............................................................................................................................................
............................................................................................................ Mouse Location
....................................................
....................................................................................................................................
.......................................................................................... Movei Clip Rotation
............................................................................................................................. -: Dragging
............................................................................................................
...................................................................... DETECTING KEYPRESSES
...........................................................................................................
................................................................................. DATES AND TIMES
...........................................................................................................
........................................................................... USING DATA
XML ......................................................
THE XML OBJECT ..............................................................................................
.........................................................................................................
.............................................................................................................
...........................................................................OBJECT-ORIENTED PROGRAMMING
.... OBJECT-ORIENTED PROGRAMMING WITH ACTIONSCRIPT 2.0
.......................................................................................... ACTIONSCRIPT CLASSES
.................................................................................................
ERROR MESSAGES ....................................................................................
............................................................................................ :
XML .......................................................................................................
: ....................................................................................................................................... -:
....................................................................................................................................... -:
...............................................................................................................................................
.....................................................................................................
............................................................................................... MOBILE : 0103546609
.......................................................................... E-MAIL : RAMEGYPT@YAHOO.COM
.
:
....
) (
.
) (
:
..... )(
) (
:
..... ) . (
) (
) (
: Components )) (( ) . (
: Properties
) . (
) (
: Actions ) . (
) (
WXYZWXYZWXYZ
.
Corel Draw Adobe
Illustrator .
-: Corel Draw
-
.
- Corel Draw
Convert To Curves<Arrange
.
- File Export
Adobe Illustrator
AI Export OK ...
-
Import File .
- Modify Break Apart
Shift
.
** Ctrl+A
.
WXYZWXYZWXYZ
:
- .
- Edit Copy & Minimize
.
-
Ctrl+V
.
- )(Fonts
AXt .
) . (
) (
.
WXYZWXYZWXYZ
) (
.
:
.
Modify Document Ctrl + M
Document Properties ) ( -:
- :
:
.
.
.
Convert to Symbol Insert F8 )(
Graphic . OK
)(
Library )) Window (( .
.
Insert Keyframe F6
.
.
Tween Create Motion
.
. Ctrl+Enter )(
:
)(
)(
Tween
.
- :
)
( .
)
( .
) (
:
- :
.
Shift
Break Apart .Modify
. F6 Delete
.
.
Properties Shape Tween
).(
)(
Ctrl+Enter
- :
Modify Shape Hint Add Shape
Ctrl+Shift+H
):(
)(
))
(( Hints Show Shape
View ):(
)(
.Ctrl+Enter
WXYZWXYZWXYZ
):(
)(
:
) : (
:
- :
Properties ):(
)(
- :
))
((
-:
.
F8 .Graphic
.
):(
)(
):(
)(
. guides view
snap to guides
Create Motion Tween . Ctrl+Enter
- :
:
.
.
. Craete Motion Tween
. Mask
):(
)(
. . Ctrl+Enter
-:
.Enter
:
. Mask Text Masked . Colors
)(
. Colors
F6 :
)(
. Text COLOR F8
Graphic
F6 .
. Text
. Create Motion Tween
. Text Mask
):(
)(
. . Ctrl+Enter
- :
.
WXYZWXYZWXYZ
) ( Library Window
:Ctrl+l
)(
Options New Symbol
) (
:
)(
Scene
Convert to Symbol Insert
Library window
.
:
. Break Apart Modify .Ctrl+B
.
.
:
. .
. edit with options select
. external editor
. . open
. .
-:
. .
. update . options
. update media . update
:
Common Libraries Window )(
)(
.
-:
-:
. .
. save file . save as
. libraries .
. save Common Libraries
. Window
Test Movie
.Control
:
. Ctrl+l Option
New Symbol Graphic
Sadaa Group ) (
:Text
)(
. Scene1
.F6
.
.
. F6
) ( Alpha
Properties Color Alpha
):(
)(
. Motion Properties
. Ctrl+Enter
(
:
. .
. Ctrl+l Symbol1 )(
).(
.
Yasin Fares .Scene1
.
. Ctrl+Enter
WXYZWXYZWXYZ
...
Front Page .... html
-: Front page
- .
- File Export Movie sadaa
swf Save OK OK .
) . (
) (
- Front page Browser
OK .... ) .... (
.... Front page
) (
-: html
. swf
"<embed width="550" height="400
"src="http://www.sadaagroup.com/sadaa.swf
>"type="application/x-shockwave-flash
X ) ( .
Front page
WXYZWXYZWXYZ
) ( -:
.
Loop
Properties . Sync = Stream
File Import wav
Open
Ctrl+l Properties Sounds
.
:
. .
. ply .
.
.F5
.
).(
)(
.
WXYZWXYZWXYZ
.
Actions
.Common Libraries
-:
-:
. Graphic
Insert New Symbol Static
)-:(
)(
Scene1 .
.
Spinner ):(
)(
Scene1 .
. Movie Clip
Spinner Movie
Ctrl+l Spinner
+ F6
Create Motion Tween
. Scene1
. Button Insert
New Symbol Button )-:(
)(
:
:Up
:Over .
:Down .
:Hit
Up .Hit
. Up Static
F6 Over
Spinner Movie Down
Down
)-:(
)(
Scene1 . Ctrl+Enter
WXYZWXYZWXYZ
) Vector graphics
( Bitmaps :
- :
.
- : Pixels
.
-:
. Import . File
. .
. Open .
.
:
- Options .Properties Bitmap
-:
. .
. Option Library Properties
).(
)(
. Allow smoothing
.
. Compression Photo
(JPEG . Lossless(PNG/GIF
. quality
. use document default quality
. test .
)(
. Threshold Color .
.
. Area Minimum
.
. . Fit Curve Normal
. Smooth
. Threshold Corner
. .
. Ok .
.
) (Free Hand
.
-:
Break apart
.
. .
. Apart Break Modify
Wand Magic
.
. .
magic wand ).(
. lasso
)(
. magic wand properties .
. Threshold
.
. Smoothing
.
.
Shift
Group .Modify
-:
. .
. Break apart . Modify
. DROPPER
.
.
.
OVAL rectangle ).(
.
.
)(
Action Script
Action Script
.
Animation Navigation
User Input Get Data
Calculations Play Sounds .
ActionScript .0
Action Script 2.0 .
Action Script 3.0 .
: AS 3.0
Action Script 2
actions Actions windows actions
f9 .
Frames MovieClip
.
-: Buttons
Event
Press
.
Release
releaseOutside
keyPress
.
rollOver
.
rollOut
.
dragOver
.
dragOut
movieClip
Event
Load
Unload
enterFrame
mouseDown
mouseUp
mouseMove
keyDown
keyUp
Data
: key frames f7
ctrl+enter
.
f9 ;)( . stop
.
.
.
.
.
{ )on (press
;var myVariable:Number = 7
;"var myOtherVariable:String = "Macromedia
{ )for (var i:Number=0; i<10; i++
;)trace(i
{ )if (myVariable + 3 == 5
;)trace(myOtherVariable
}
}
}
) on (press .
} {
myVariable .
myOtherVariable . Macromedia
. for
trace .
. if
.
Data and Data Types
.
!
:Variables
..
.
.. : " " UserName "" ..
"" Discount .
" " String
.Numeric Value
..
.. : Objects .
Types of data
: .
String
Number-: .
Boolean :
" : " True" " False
"" "" .. .True
Object-:
MovieClip
Null
Undefined
Declaring Variables
..
Compiler
..
.
) ( ..
Design Time Compile
.Runtime
Time
- ) .(actions
:
break
case
class
continue
default
delete
dynamic
else
extends
for
function
get
if
implements
import
in
instanceof
interface
new
private
public
return
set
static
switch
this
typeof
var
void
while
with
. .. "_" .
.
: " ".
.
.
) ( Case-insensitive myAge myage MYAGE
.
-:
: Var
Var :
;var sProduct:String
;"sProduct = "car
;"var sProduct:String = "car
var :
sProduct )( trace
Output panel :
;"var sProduct:String = "car
;)trace(sProduct
// car
sProduct -:
sProduct = 120
-:
Type mismatch in assignment statement: found Number where String is
required.
. ) " " (
the quotation marks
;var numWrinkles:Number = 55
-:
;numWrinkles = 60
) ( (quotation marks). -:
;var age:Number = 38
;var married:Boolean = true
;var hasChildren:Boolean = false
-:array
.
..
..
!
..!
" "
.
Array
.Index
:
;)"var childrenArr:Array = new Array("Pylon", "Smithers", "Gil
-:
;]"var childrenArr:Array = ["Pylon", "Smithers", "Gil
:
;)(var myArr:Array = new Array
;"myArr[0] = "January
;"myArr[1] = "February
;"myArr[2] = "March
;"myArr[3] = "April
) (object :
;)(var myObj:Object = new Object
;"myObj.firstName = "Steve
;myObj.age = 50
;)"myObj.childrenArr = new Array("Mike", "Robbie", "Chip
//
var myObj:Object = {firstName:"Steve", age:50, childrenArr:["Mike",
;}]""Robbie", "Chip
: //
.
Operators
Boolean operators
AND , OR , NOT
-:
Ask Michael AND Nabil
Ask Michae OR Nabil
Ask Michael NOT Nabil
.
-:
Description
Operator
Not
++
--
()
[]
Array element
Member access
++
Pre-increment
--
Pre-decrement
new
Allocation
delete
Deallocation
typeof
Type of object
void
Undefined type
<<
>>
>>>
<
<=
>
>=
==
!=
&
Bitwise AND
Bitwise XOR
Bitwise OR
&&
Logical AND
||
?:
Conditional
Assignment
Compound assignments
;A=5
;B=A
;C=18
-:
)if (A==B
)if (A==18
!!!!!!!!!!!!!!
-:
-
-:
A = B + C * 5 3
-
-:
B=5
C = 10
A = B + C * 5 3
B C
A
B C
!!!!!!!!!!!
B=5
A = B + C * 5 3
C = 10
B A C
.........
) (
B=7
C=7
D = B-C
A = B/D
= B = C C B = D -
) (
=
.
)A = (A+B) * ( C D) (Q * M
-:
-:
;z=x%y
)-: (-- ++
.
y z
-:
;y = 5
; z = y++
y z y .
[\]^[\]^[\]^
-:
Flow- control statement
..
.. .
:If
.
) True (False:
;myNumber = 10
{)if(myNumber < 20
;)"trace("myNumber is less than 20
}
: myNumber
} { trace
} {
) ( If
} {
:elseIf
:
;myNumber = 10
{)if(myNumber > 20
;)trace("myNumber is greater than 20
}
{Else
;)trace("myNumber is less than or equal to 20
}
: myNumber
} { trace
else
-: ifElse
if else if
;myNumber = 10
{)if(myNumber < 20
;)"trace("myNumber is less than 20
}
{)else if(myNumber < 50
;)"trace("myNumber is less than 50 but greater than or equal to 20
}
if and -:or
{ )on (press
{ ))if ((a == 7) and (b == 15
;)gotoAndPlay(20
}
}
-:
{ )on (press
{ ))if ((a == 7) or (b == 15
;)gotoAndPlay(20
}
}
if -:
;myNumber = 10
{)if(myNumber < 20
;)"trace("myNumber is less than 20
}
{)else if(myNumber < 50
;)"trace("myNumber is less than 50 but greater than or equal to 20
}
{else
;)"trace("myNumber is greater than or equal to 50
}
[\]^[\]^[\]^
-:switch . Case
..
{)( switch
: case
: case
...
][default
}
-:
x
. case 1
x = 10;
switch( x ){
case 10:
trace("case 1");
break;
case 10:
trace("case 2");
break;
}
-:
exp = "hello";
switch( exp ){
case "hello":
trace("case 1");
case "hi":
trace("case 2");
break;
}
case 1
-: switch if
switch( exp ){
case 1:
//do task a
case 2:
//do task b
case 3:
//do task c
}
-: if
if( x == 3 ){
//do task c
}
else if( x == 2 ){
//do task b
//do task c
}
else if( x == 1 ){
//do task a
//do task b
//do task c
}
-: switch
switch( user_command_string ){
case "move north":
case "go north":
case "north":
case "n":
trace("you have moved north");
break;
case "move south":
case "go south":
case "south":
case "s":
trace("you have moved south");
break;
default:
trace("I'm sorry, I don't understand "+ user_command_string);
}
( switch ) :
( true)
( false) ( true)
. (default)
Loop Structures
" " :For
looping
i
i
** For..............
for
;i=0
;i<1000
i++
x
i=0 i++ i<100
0
1
2
3
4
.
.
.
99
{)on(press
{ )for(var x:Number=1;x<13;x++
{ )for(var y:Number=1;y<13;y++
var z:Number = x * y
)trace(x+"*"+y+"="+z
}}}
.
)for(var x:Number =1;x<13;x++
{
{
-:
{ )for(var y:Number=1;y<13;y++
;var z:Number = x * y
)trace(x+"*"+y+"="+z
}
x y
z -:
;z = x * y
X
Y
x
y Y X
-:
1*1=1
1*2=2
1*3=3
.
.
.
1 * 12 = 12
X
=
-:
2*1=2
2*2=4
2*3=6
.
.
.
2 * 12 = 24
-:
12 * 1 = 12
12 * 2 = 24
12 * 3 = 36
.
.
.
12 * 12 = 144
movieClip myClip_mc
{ )for (var i:Number=0; i<=10 ; ++i
;)myClip_mc.duplicateMovieClip("myClip_mc" + i, i
}
The while Loop
while .
) (while :
- .
- ). (while
-
.
-:
;x = 0
{) while( x < 100
;)trace(myNumber
;x++
}
** ..........
while
X<100
;x++
X ) X
X
.
.
) (do while :
- .
- ). (do while
-
.
;myNumber = 99
{do
;)trace(myNumber
;)}while(myNumber++ < 10
while do while
) (while
) (do while
) (do ) (do while
) (while .
Nested Loops
;var i:Number = 0
{ )while (++i <= 10
;var j:Number = 0
{ )while (++j <= 10
// perform these actions
}
}
...
//
;)(var myArr:Array = new Array
// value1
;"myArr[1] = "value1
;"myArr[0] = "value0
//
;var i:String
{ )for (i in myArr
//
trace("key: " + i + ", value: " + myArr[i]);
}
ZYXWZYXWZYXW
functions and methods
functions
-:
-:
.
-:
{ )function myFunction (parameter1:DataType,parameter2:DataType,etc.
;//actions go here
}
myFunction
parameter1
:
;)myFunction(parameter1, parameter2
.
-:
) ( function
{
; Return
}
)on(press
{
)function myFunction1(s1:Number,e1:Number
){for(var x:Number=s1;x<e1+1;x++
{
)for(var y:Number=s1;y<e1+1;y++
{
var z:Number = x * y
)trace(x+"*"+y+"="+z
}}}
//
;)myFunction1(1,5
}
Prototype )(s1:Number,e1:Number
s1 e1
;)myFunction1(1,5
:
{)function convertToMoonWeight (myWeight:Number
;var weightOnMoon:Number = myWeight/6.04
}
-:
;)convertToMoonWeight(165
-:
{)function openWindow(url:String, window:String
;)getURL(url, window
}
-:
;)"openWindow("http://www.yahoo.com", "_blank
-:
{ )on (press
{ )function myFunction(num
;var newNum = num + 3
;return newNum
}
;))trace(myFunction(7
;))trace(myFunction(13
trace(myFunction(2));
}
10
16
5
lineStyle()
path.lineStyle(thickness, color, alpha)
-:
_root.myClip_mc.lineStyle(10, 0x009900, 100);
moveTo()
path.moveTo(x, y);
-:
_root.myClip_mc.lineStyle(10,0x009900,100);
_root.myClip_mc.moveTo(100,100);
lineTo() y x
-:
_root.createEmptyMovieClip("canvas_mc",1);
_root.canvas_mc.lineStyle(2,0x009900,100);
_root.canvas_mc.moveTo(100,100);
_root.canvas_mc.lineTo(200,150);
-:
this.createEmptyMovieClip("myMovieClip_mc", 1);
myMovieClip_mc.lineStyle(1, 0x000000, 100);
myMovieClip_mc.curveTo(0, 100, 100, 100);
-:
_root.createEmptyMovieClip("rectangle_mc", 1);
rectangle_mc.lineStyle(1, 0x000000, 100);
//
rectangle_mc.lineTo(100, 0);
rectangle_mc.lineTo(100, 50);
rectangle_mc.lineTo( 0, 50);
rectangle_mc.lineTo( 0, 0);
-:
MovieClip.prototype.drawCircle = function (radius, x, y)
{
var angleDelta = Math.PI / 4;
var ctrlDist = radius/Math.cos(angleDelta/2);
var angle = 0;
var rx, ry, ax, ay;
this.moveTo(x + radius, y);
-:
_root.createEmptyMovieClip("holder_mc", 1);
with (_root.holder_mc) {
lineStyle(0, 0x000000, 0);
rotation = 90 * (Math.PI/180);
colors = [ 0x6666FF, 0xFF6600 ];
alphas = [ 100, 100 ];
ratios = [ 0, 255 ];
matrix = {matrixType:"box", x:0, y:150, w:200, h:100, r:rotation };
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveTo(0,0);
lineTo(550,0);
;)lineTo(550,300
;)lineTo(0,300
;)lineTo(0,0
;)(endFill
}
-: Ctrl + enter .
Using event handler methods
..
Event Handler
onPress
.
. object.eventMethod
-:
object.eventMethod = function () {
// Your code here, responding to event.
}
:
next_btn.onPress = function () {
nextFrame();
}
-:
// Assign a function reference to button's onPress event handler.
next_btn.onPress = goNextFrame;
// Define goNextFrame() function.
function goNextFrame() {
nextFrame();
}
!!
//
next_btn.onPress = goNextFrame();
//
next_btn.onPress = goNextFrame;
ZYXWZYXWZYXWZYXW
:
this.createTextField("my_txt", 99, 10, 10, 200, 20);
my_txt.border = true;
my_txt.type = "input";
this.createTextField("myOther_txt", 100, 10, 50, 200, 20);
myOther_txt.border = true;
myOther_txt.type = "input";
myOther_txt.onSetFocus = function(my_txt:TextField) {
my_txt.text = "I just lost keyboard focus";
}
-:
loadMovie("myBitmap.jpg", "myClip_mc");
-:
;)var soundObjectName:Sound = new Sound (Target
movieclip myMovieClip_mc
:
;)"var mySound:Sound= new Sound ("myMovieClip_mc
-:
;)mySound.setVolume (50
mp3
;)(var myFavMP3:Sound = new Sound
mySong.mp3
;)myFavMP3.loadSound("mySong.mp3", true
true swf false
:
;)myFavMP3.loadSound("mySong.mp3", false
start
;)(myFavMP3.start
ZYXWZYXWZYXWZYXW
;)( stop
;)gotoAndPlay(7
;)gotoAndPlay(20
//
)"gotoAndPlay("my frame label
Scene
;)"gotoAndPlay("My Scene","My Frame
ZYXWZYXWZYXWZYXW
ZYXWZYXWZYXWZYXW
Mouse Location
_xmouse _ymouse
: Movie clip f9 -:
{ )onClipEvent (enterFrame
;)trace(_root._xmouse
;)trace(_root._ymouse
;)""(trace
}
. enterFrame
box1_txt box2_txt
-:
;)(var mouseListener:Object = new Object
{ )(mouseListener.onMouseMove = function
//
// return X and y
;box1_txt.text = _xmouse
;box2_txt.text = _ymouse
;}
;)Mouse.addListener(mouseListener
Movei Clip Rotation
: myClip f9 :
;myClip._rotation = 90
;myClip._rotation++
;_root["myClip"]._rotation = 45
;this._rotation += 0.5
. this
{ )onClipEvent (load
//
;origWidth = this._width
;origHeight = this._height
}
{ )onClipEvent (enterFrame
//
;dx = _root._xmouse-this._x
;dy = _root._ymouse-this._y
//
;)sx = 100*dx/(origWidth/2
;)sy = 100*dy/(origHeight/2
//
;this._xscale = sx
;this._yscale = sy
}
( 3D -:
{ )onClipEvent(load
;scaleAmt = 10
;x = 525
;y = 25
}
{ )onClipEvent(enterFrame
;scaleAmt++
;x -= 5
;y += 5
;this._xscale = scaleAmt
;this._yscale = scaleAmt
;this._x = x
;this._y = y
}
** -:
{ )onClipEvent(load
;this._x = 525
;this._y = 25
}
{ )onClipEvent(enterFrame
;this._xscale++
;this._yscale++
;this._x -= 5
;this._y += 5
}
ZYXWZYXWZYXWZYXWZYXWZYXW
Visibility
;myClip._visible = false
visible true false .
;myClip._alpha = 50
alpha
Fading
{ )onClipEvent(enterFrame
{ )if (this._alpha > 0
;this._alpha -= 5
}
}
-: Dragging
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.stopDrag();
}
}
UUUUUUUUUUUUUUUUUUUUUUUU
Detecting Keypresses
:
{ )"on (keyPress "a
;)"trace("Key 'a' pressed.
}
><Left
><End
><PageUp
><Right
><Insert
><PageDown
><Up
><Delete
><Tab
><Down
><Backspace
><Escape
><Home
><Enter
><Space
{ )">on (keyPress "<Left
;)"trace("Left pressed.
}
:
{ ))if (Key.isDown(Key.LEFT
;)"trace("The left arrow is down
}
Key.isDown true false . true
:
Key.BACKSPACE
Key.ENTER
Key.PGDN
Key.CAPSLOCK
Key.ESCAPE
Key.RIGHT
Key.CONTROL
Key.HOME
Key.SHIFT
Key.DELETEKEY
Key.INSERT
Key.SPACE
Key.DOWN
Key.LEFT
Key.TAB
Key.END
Key.PGUP
Key.UP
Key Listeners
;)Key.addListener(_root
{ )(_root.onKeyUp = function
;))(trace(Key.getAscii
}
a
;)))(trace(String.fromCharCode(Key.getAscii
:
.
f8
f9
speed //
{ )onClipEvent(load
;x = this._x
;y = this._y
;speed = 5
}
{ )onClipEvent(enterFrame
{ ))if (Key.isDown(Key.LEFT
;x -= speed
}
{ ))if (Key.isDown(Key.RIGHT
;x += speed
}
{ ))if (Key.isDown(Key.UP
;y -= speed
}
{ ))if (Key.isDown(Key.DOWN
;y += speed
}
;this._x = x
;this._y = y
}
:
instance of :
car_mc f9 :
//
;var distance:Number = 10
x y
;)this.createTextField("display_txt", 999, 0, 0, 100, 20
;)(var keyListener:Object = new Object
{ )(keyListener.onKeyDown = function
{ ))if (Key.isDown(Key.LEFT
Math //
max //
;)car_mc._x = Math.max(car_mc._x - distance, 0
;"display_txt.text = "Left
{ ))} else if (Key.isDown(Key.RIGHT
// min
car_mc._x = Math.min(car_mc._x + distance, Stage.width car_mc._width);
display_txt.text = "Right";
} else if (Key.isDown(Key.UP)) {
car_mc._y = Math.max(car_mc._y - distance, 0);
display_txt.text = "Up";
} else if (Key.isDown(Key.DOWN)) {
car_mc._y = Math.min(car_mc._y + distance, Stage.height car_mc._height);
display_txt.text = "Down";
}
};
Key.addListener(keyListener);
Dates and Times
// Create a new Date object.
today = new Date( );
// Displays client-side date and time
trace(today);
Using Data
:
color=red&area=100
variables.txt
.
LoadVars //
;)(var lvSampleData:LoadVars = new LoadVars
//
{ lvSampleData.onLoad = function(bSuccess:Boolean):Void
;)"trace("data loaded
;}
;)'lvSampleData.load('variables.txt
true false
true .
color area :
{ lvSampleData.onLoad = function(bSuccess:Boolean):Void
{ )if(bSuccess
;)trace('color = ' + this.color
;)trace('area = ' + this.area
}
{ else
;)'trace('There is an error with the data.
}
;}
;)'lvSampleData.load('variables.txt
color = red :
area = 100
:
;)(var lvExample:LoadVars = new LoadVars
{ lvExample.onData = function(sText:String):Void
;)trace(sText
;}
;)'lvExample.load('variables.txt
color=red&area=100
electricBill.txt :
&electricBill=60
//.
;)this.createTextField("my_txt", 99, 10, 10, 200, 20
;my_txt.border = true
;"my_txt.type = "input
)( Loadvars //
xml
myXML = new XML("<user><name>Gary</name><ID>47</ID></user>");
trace(myXML.firstChild);
"<user><name>Gary</name><ID>47</ID></user>".
myXML = new XML("<user><name>Gary</name><ID>47</ID></user>");
trace(myXML.firstChild.firstChild);
<name>Gary</name>
childNodes
myXML = new XML("<user><name>Gary</name><ID>47</ID></user>");
trace(myXML.childNodes[0].childNodes[0]);
myXML = new XML("<user><name>Gary</name><ID>47</ID></user>");
trace(myXML.childNodes[0].childNodes[0].childNodes[0]);
Gary :
myXML = new XML("<user><name>Gary</name><ID>47</ID></user>");
trace(myXML.childNodes[0].childNodes[1].childNodes[0].nodeValue);
:
: xml
myXML = new XML();
newElement = myXML.createElement("user");
myXML.appendChild(newElement);
newElement = myXML.createElement("name");
myXML.childNodes[0].appendChild(newElement);
newText = myXML.createTextNode("Gary");
myXML.childNodes[0].childNodes[0].appendChild(newText);
newElement = myXML.createElement("ID");
myXML.childNodes[0].appendChild(newElement);
newText = myXML.createTextNode("47");
myXML.childNodes[0].childNodes[1].appendChild(newText);
If you want to change the value of a text node, you need to set the nodeValue
property:
nodevalue
myXML.childNodes[0].childNodes[1].childNodes[0].nodeValue = 53;
Attributes
<user>
<name type="alias">Gary</name>
<ID>47</ID>
</user>
:
myXML = new XML("<user><name type='alias'>Gary</name><ID>47</user>");
trace(myXML.childNodes[0].childNodes[0].attributes.alias);
trace(myXML.childNodes[0].childNodes[0].attributes["alias"]);
xml
myXML = new XML("<user><name>Gary</name><ID>47</user>");
trace(myXML.childNodes[0].childNodes.length);
myXML = new XML("<user><name>Gary</name><ID>47</user>");
trace(myXML.childNodes[0].childNodes[0].nodeName);
xml
<book>
<title>ActionScript Arabic book</title>
<authors>Michael nabil</authors>
</book>
xml
books.xml xml
book.xml
// book_xml xml
var book_xml:XML = new XML();
//xml
this.book_xml.ignoreWhite = true;
// xml
this.book_xml.load("book.xml");
.
Properties, Methods, and Return Types of the XML Object
xml
PROPERTY AND
METHODS
RETURN TYPES
Attributes
ChildNodes
FirstChild
Read-only; references the first child in the list for the specified node
hasChildNodes()
Returns true if the specified node has child nodes; otherwise, returns
false
LastChild
References the last child in the list for the specified node
nextSibling
Read-only; references the next sibling in the parent node's child list
RETURN TYPES
NodeName
NodeType
The type of the specified node (XML element type = 1, text node
type = 3)
NodeValue
ParentNode
previousSibling
RemoveNode()
toString()
Object-Oriented Programming
: Object )( ... Object Object
... ...
:Oriented
Money-oriented person
.
:Object-oriented Programming
Objects
Object
.
......
OOP
) Execution Files (DLL Files
OOP
OOP .
....
class : extends ...
.
+ .
+.
+ .
+ .
+ .
+ .
:
.... ..
...
... ...
..
...
..
.
...
... ..
...
.... ..
" ..
"
..
Abstraction
) (.
:
mov
..
... ...
" "
...
..
.
...
..
.
...
..
Write Once, run every where :
.
.
).Abstract Data Type (ADT
number
.
Manipulate
" "/ * + - .
Strings .
number
.
ADT OO
.
:
Variables .Functions
/
...
...
...
...
.
:
number Fabric; // 1=Blue, 2=Red.
:
: classes
: :
.
) (
class
.. objects .
class
... object
... ...
object instance .
: .Inheritance
Class Class
.classes Class .
: Components
...
class
class
.
:Properties
.. .
classes
.
:Behaviors
: ) (
.
:Encapsulation
.
: " " :
...
Stack " "Attributes
... Stack " "Operations or Methods Pop .Push
: Data Hiding
class creator
client programmers
.
..
.
.. private
public ....
) (
:
;)"Console.Write (" O O P\n
O O P Write
...
Console Write
...
Console
.
: :
private
public, protected and private protected .
.Polymorphism
/ Parameters .
: Cohesion and Coupling
.
:
.
... .
.
.
Coincidental Cohesion
.
OO :
-
-
-
-
-
Class
.
.
.
:
. .
.. . User Defined
.. Types .
..
.
time line as
. as
Product Product.as
Product
Data .
:
;)(var myProduct:Product = new Data.Product
;import Data.Product
:
{ class Product
;var id:Number
;var prodName:String
;var description:String
;this.id = id
;this.prodName = prodName
;this.description = description
}
}
Public and Private Attributes
:Public
.
:Private . Class
The extends Keyword
public
MovieClip class Drag
onPress(), onRelease(), startDrag(), and stopDrag(),
. MovieClip class
{ classclass Drag extends MovieClip
{ )( function Drag
;)(onPress = doDrag
;)(onRelease = doDrop
}
{)(private function doDrag
;)(this.startDrag
}
{)(private function doDrop
;)(this.stopDrag
}
}
linkage:
- : f8 :
.Drag
:Document class class
class swf Property inspector
. ActionScript 3.0 Publish
). ( File > Publish Settings > Flash tab > Settings button
class class
. :
simpleBall.fla -
Instance Name circle
f9 ball_mc
: -
ball_mc.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(event:MouseEvent):void {
trace("You clicked the ball");
}
-
. AS2 onPress() MouseEvent.CLICK
: -
ball_mc.buttonMode = true;
. control+enter -
-
MouseEvent.MOUSE_UP MouseEvent.MOUSE_DOWN
:
ball_mc.buttonMode = true;
ball_mc.addEventListener(MouseEvent.CLICK, clickHandler);
ball_mc.addEventListener(MouseEvent.MOUSE_DOWN,
mouseDownListener);
ball_mc.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener);
function clickHandler(event:MouseEvent):void {
Error Messages
:
Error
number
Message text
1093
1094
1095
1096
The same member name may not be repeated more than once.
1097
1099
1100
1101
Type mismatch.
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
A class may not extend the same interface more than once.
1122
1123
Error
number
Message text
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
ActionScript 2.0 class scripts may only define class or interface constructs.
1141
The name of this class, '<A.B.C>', conflicts with the name of another class that was loaded,
'<A.B>'.
(This error occurs when the ActionScript 2.0 compiler cannot compile a class because of the full
name of an existing class is part of the conflicting class' name. For example, compiling class
mx.com.util generates error 1141 if class mx.com is a compiled class.)
1142
1143
1144
1145
1146
The property being referenced does not have the static attribute.
1147
1148
1149
1150
You must export your Flash movie as Flash 7 to use this action.
1151
You must export your Flash movie as Flash 7 to use this expression.
1152
1153
1154
1155
Error
number
Message text
1156
1157
1158
1159
1160
1161
1162
1163
The keyword '<keyword>' is reserved for ActionScript 2.0 and cannot be used here.
1164
1165
Only one class or interface can be defined per ActionScript 2.0 .as file.
1166
The class being compiled, '<A.b>', does not match the class that was imported, '<A.B>'.
(This error occurs when a class name is spelled with a different case from an imported class. For
example, compiling class mx.com.util generates error 1166 if the statement import mx.Com
appears in the util.as file.)
1167
1168
1169
1170
The base class name you have entered contains a syntax error.
1171
The base interface name you have entered contains a syntax error.
1172
1173
1174
The class or interface name you have entered contains a syntax error.
1175
1176
1177
1178
Instance variables and functions may not be used to initialize static variables.
1179
Runtime circularities were discovered between the following classes: <list of user-defined
classes>.
This runtime error indicates that your custom classes are incorrectly referencing each other.
1180
1181
The currently targeted Flash Player does not support the releaseOutside event.
1182
The currently targeted Flash Player does not support the dragOver event.
1183
The currently targeted Flash Player does not support the dragOut event.
1184
The currently targeted Flash Player does not support dragging actions.
1185
The currently targeted Flash Player does not support the loadMovie action.
1186
The currently targeted Flash Player does not support the getURL action.
Error
number
Message text
1187
The currently targeted Flash Player does not support the FSCommand action.
1188
1189
The class '<A.B>' cannot be imported because its leaf name is already resolved to the class that
is being defined, '<C.B>'.
(For example, compiling class util generates error 1189 if the statement import mx.util
appears in the util.as file.)
1190
The class '<A.B>' cannot be imported because its leaf name is already resolved to a previously
imported class '<C.B>'.
(For example, compiling import jv.util generates error 1190 if the statement import
mx.util also appears in the AS file.)
1191
1192
Class member functions cannot have the same name as a superclass' constructor function.
1193
The name of this class, '<ClassName>', conflicts with the name of another class that was loaded.
1194
1195
The identifier '<className>' will not resolve to built-in object '<ClassName>' at runtime.
1196
The class '<A.B.ClassName>' needs to be defined in a file whose relative path is <'A.B>'.
1197
1198
The member function '<classname>' has a different case from the name of the class being
defined, '<ClassName>', and will not be treated as the class constructor at runtime.
1199
1200
1201
The only attributes allowed for constructor functions are public and private.
1202
The file 'toplevel.as', which is required for typechecking ActionScript 2.0, could not be found.
Please make sure the directory '$(LocalData)/Classes' is listed in the global classpath of the
ActionScript Preferences.
1203
1204
1205
The currently targeted Flash Player does not support the FSCommand2 action.
1206
1207
1208
1210
1211
1212
The ASO file for the class '<ClassName>' could not be created. Please make sure the fullyqualified class name is short enough so that the ASO filename, '<ClassName.aso>', is less than
255 characters.
1213
This type of quotation mark is not allowed in ActionScript. Please change it to a standard
Error
number
Message text
(straight) double quote.
: http://www.c4arab.com
:
.
Xml
XML
.. XML
XML
Binary Files
.. XML
.
. XML
XML .
) . ( Notepad - XML Internet Explorer 5.5 .
XML
.
.
. .
: -:
) (- .
Word Perfect Microsoft Word
.
.
.
.
Platform
.
: -:
. ) ( -
.
). (a
.
. .
-:
.
.
SGML
Standard Generalized Markup Languge .
Self Describing
.
.
XML
eXtensible Markup Language XML
HTML .
SGML .
HTML
XML SGML .
XML . SGML
XML XML
.
Emad Adly
HTML .
XML .
SGML XML
Name ><first > <last
.
name.xml
.
XML
) (- > <name .
Style Sheet XML
.
.
XML XML .
HTML Tags .
-: XML Parsers
XML .
Parsers XML .
. XML
.XML .
XML XML -:
Emad XML .
XML XML
.
.
XML
.
-: Extensible
XML .
.
. .
xml . .
Extensible
.
XML
.
.
Scalable Vector Graphics SVG XML
.
MathML XML .
Chemical Markup Language CML XML
WML
XML
XML .
XML
XML .
. XML 1.0 XML
XML XML
.sDTD
XML . .
.
.
.
: .
.
.
.
.
.
.
.
.XML
.
XML
. XML
.XML
XML Visual
Basic .
.
XML Web
Server .
. RPC
.
. .
.
xml
.
XML .
XML
XML XML
.
.
.
.
Object model
. XML
Parent / Child / .
elements .
> < Name > < First > < First > < Name <
> First> < Middle > < Last >< Name
Emad >. < First
Tree Branches
Leaves
:
Element Content
> < Name element content
.
Simple Content
> < First >< Middle> < Last Simple Content
.
Mixed Content
Mixed Content .
XML
XML -:
(
and Elements
Tag Start
Tag . End Tag
. /
XML Element .
XML XML Well-formed
XML Documents
-
XML .
XML Case-Sensitive
XML .
-:
XML
. -:
(_)underscore
.
-
XML .
>
Attributes
XML attributes
. XML
..
.
Metadata
XML
Nickname
.
.
..
.
.
.
.
XML .
. .
(
Comments
XML
.
.
XML
XML
.
> ! < -- HTML
..
(
Elements
Empty
XML
...
( XML
Declaration
XML
XML
XML .
XML .
XML Encoding
Encoding Attributes
a ASCII A .
ASCII
ASCII
...
. Unicode
XML
'encoding=UTF-16
XML UTF-
8 UTF-16
XML Standalone
XML yes
no
yes
No .
( PCDATA .
PCDATA SGML
. XML
PCDATA XML
< &
..
..
< Tag
Space &
PCDATA
Escaping Characters CDATA
.
Escaping Characters
&
..
..
XML .
&
>
<
"
;& amp
;& lt
;& gt
;&apos
;&qu
. Character Referances
Unicode &# ;
XML & # & xA#
CDATA
CDATA
CDATA
PCDATA CDATA
..
: XML
xml
.
xml XML Parser xml
.
.
DataChannel XJ Parser
DataChannel xml
.
http://xdev.datachannel.com/directory/xml-parser.html
IBM XML4j
IBM xml xml4j
http://www.alphaworks.ibm.com/
Apache Xerces
Apache XML Beta
C++
http://xml.apache.org/
: XML
XML XML
Error . fatal errors
XML .
fatal Errors xml
xml .
xml
. html
. html XHTML html
Html XML
XML HTML XML HTML
Tags . HTML
XML HTML . XML
. XML .
HTML . HTML
XML .
:
file.html
HTML html
. Tags
. > .. <h1> , <h2> , <body .
tags > <BLINK
. XML
xml .
self-
. describing
HTML :
Emad Adly
15-04-2003
PHP Programming
Devman karim
jimmy Adle
8-03-2004
Java Programming
salh Mohammed
12-5-2004
ASP Programming
SeGa mrscript
) (. . .
></table
PHP Programming
XML
:
XML XML
. XML Tags
. Course
html
HTML PHP Programming
italics XML tags HTML
SGML XML
.
html
XSLT
XML DOM SAX
: http://www.c4arab.com
:
.
:
:
Software
...
.
.
:
1- Shari Pfleeger, "Software Engineering - Theory and Practice", 2nd Edition
.
) ).
.
.
tool (
).
computer science
.
.
Software Engineer problem-solving
tool.
.
))
Art
hacker
.
.
:
Customer: ) (
User: ) (
.
Developer: ) ( .
))
.... .
. .
objects activities
.
.
.
1. : .
))
.
objects .
( ).
... .
2. Relationships and System Boundary
.
)
) )
Input) , boundary
.
A System :
entities.
activities.
Relationship.
boundary.
)( .
. :
1. .
2.
.
3. .
4.
5. .
6. .
7.
" " Life Cycle
Software development life cycle
:
1. Requirements analysis and definition
2. System design
3. Program design
4. )) Program implementation
5. Unit testing
6. system testing
7. system delivery
8.maintenance
( ).
) (
) ( .
Lifecycle Models:
Waterfall Model
) ( ) ( )(
.
))
)
( .
.
.
) (
.
.
) !)
.
.
Phased Development
!
.
Cycle time.
Phased Development
.
:
Incremental model
)(
.
Iterative model
.
.
.
Spiral Model
risk .
) ( .
" " Concept of
Operations ) ( .
.
.
.
.
) ( Capturing the
requirements.
)
(.
.
.
:
.
:
: :
.
.
:
.
.
Physical Environment
Interfaces
Users and human factors
Functionality
Documentation
Data
Resources
Security
Quality Assurance
. :
.
,
:
.
:
1. Correct .
2. consistent .
3. Complete
... .
4. realistic .
5. .
6. verifiable
7. traceable
" " Requirement Definition Document
: mathematical
.
) (
( (
) (
backup
) ( !
"
: ) (
) )
!.
" "
.
.
) ( )
( ) ( .
) (
) ).
iterative :
: conceptual design
.
.
:
technical
design
.
( (
.
conceptual design:
functions ) (
) (WHAT . .
.
technical design
) (HOW .
.
: :
. .
:
:
. .
.
.
Programming Guidelines
Control Structures
generality is a virtue
!
) "
!)"
" " !
:
. ) (
.
. .
. .
. .
: .
: :
.
:
( - - - )
:
:
:
. Module Testingcomponent Testing
. ) (output (input).
. Integration Testing
.
.
. Function Testing
.
Functioning System
.
Performance Testing
.
validated system
.
. Acceptance Test
Accepted system
. Installation Test
.
Sams Teach Yourself Macromedia Flash 8 in 24 Hours
By Phillip Kerman
Essential ActionScript 2.0
By Colin Moock
Object-Oriented Programming with ActionScript 2.0
By Jeff Tapper, James Talbot, Robin Haffner
Macromedia Flash MX 2004 Game Programming
by Craig S. Murray and Justin Everett-Church
Flash MX 2004 ActionScript Bible
Robert Reinhardt and Joey Lott
Object-Oriented
ActionScript for Flash 8
Peter Elst and Todd Yard
with Sas Jacobs and William Drol
Macromedia Flash 8 ActionScript: Training from the Source
By Jobe Makar, Danny Patterson
Learning ActionScript 2.0 for Macromedia Flash 8
Publisher: Macromedia
http://www.c4arab.com
http://xml.apache.org/
www.sadaagroup.com
Michael Nabil Akhnokh
Mobile : 0103546609
E-mail : ramegypt@yahoo.com
Micheal240001@yahoo.com
Education
- Faculty of Commerce, Ain Shams University
BA of Commerce
Major: Accounting
Graduation Year: 2001
- BBSA
Nasr City, EG
Basic Business Skills Acquisition Program Sponsored by Future
Generation Foundation
During the period from 13/1/2002 To 25/4/2002
- IT Professional Training Program provided by Ministry of
communication and information Technology in cooperation with
IBM Egypt
Specialty track: Solution Developer and programmer
During the period from 29/6/2003 To 15/1/2004
Qualifications and Skills
Computer Skills:
MCP (Microsoft Certified Professional) in:
Developing Web Applications with Microsoft Visual C#. NET
(Exam 70 315), (January 2004)
- Operating Systems (Windows 98, Windows 2000 server,
Linux)
- Skillfully using all Office Applications (Access, Word,
PowerPoint, Excel)
- A background knowledge about Network
- Programming Languages: (C, C++, C#, Java, Visual Basic 6.0)
-Web developing: (HTML, ASP, ASP.NET, PHP , JavaScript,
VBscript)
-Web design: (FrontPage 2003, Photoshop 7, Switch MX,
Flash MX2004, Action Script 2 & 3)
- Courses attended about Database:
Database Methodology and Design
SQL Server 2000 Programming
MySQL 4.0
Oracle 9i DBA Fundamentals I
Other Courses
- Project Research, Development and Presentations.
- Business Concepts.
Experience and Projects:
1) Information Project Group( IPG) Company
Position: Working on a variety of projects in the field of distance
learning.
Environment: FlashMx2004 and Action Script 2.0
- Please check(www.ipgegypt.com/afdl.htm)
www.faculity4eg.cjb.net