|

|
sp10
|
|
|

|
week one
|
|
|

|
A
|
|
|

|
write the 3 pigs as sequential , then procedural
|
|
|

|
B
|
|
|

|
AS intro
|
|
|

|
ch 2
|
|
|

|
review 3 little pigs
|
|
|

|
a brief history of AS
|
|
|

|
began as sequential language: executed line by line
|
|
|

|
then moved to procedural (used functions- could be reused)
|
|
|

|
then oop
|
|
|

|
what the heck is dot syntax?
|
|
|

|
Datatypes (Number (float), int (whole #), unint (unsigned whole #), String , Boolean, Array, Obeject)
|
|
|

|
variables
|
|
|

|
var myName:String="Cara"
|
|
|

|
var myNumber:Number= 1;
|
|
|

|
var myArray:Array= ["Mojo", "Eddie", "Yma", "Nikki", "OrangeCat"]
|
|
|

|
var otherArray:Array = [1,2,3,4,5]
|
|
|

|
conditional statements
|
|
|

|
comparison and logical operators
|
|
|

|
ch 2 exercises- examples in demo
|
|
|

|
go through examples
|
|
|

|
review at end of class
|
|
|

|
what the *@! is an array?
|
|
|

|
intro to functions : making , calling, passing arguments
|
|
|

|
week two
|
|
|

|
BOOK DOWNLOADS
|
|
|

|
CH 3: properties, methods and events
|
|
|

|
properties
|
|
|

|
like adjectives that describe an object
|
|
|

|
ex: a mc can have properties such as width, height, alpha..
|
|
|

|
we would access those properties by writing (dot syntax):
|
|
|

|
myMovie.alpha=.5 (note that alpha is now 0-1)
|
|
|

|
myMovie.x= 200 (places this on the x axis of the stage)
|
|
|

|
myMovie.scaleY= .25
|
|
|

|
see list on page 33
|
|
|

|
event listeners and handlers
|
|
|

|
old school button functions:
|
|
|

|
in the beginning was:
on (press){ //do something //like gotoAndPlay(5); }
then
myButton.onPress = function(){
//do something //function "meat" here }
|
|
|

|
AND NOW: event listeners and handlers
|
|
|

|
myMovie.addEventListener(MouseEvent.MOUSE_DOWN, onDown, false, 0, true)
function onDown(evt:MouseEvent) :void{ fred.alpha-=.1; //or whatever
}
|
|
|

|
advantages of event listeners!
|
|
|

|
can apply the same function again and again and again:
|
|
|

|
evt.target
|
|
|

|
myMovieClip.addEventListener(MouseEvent.MOUSE_DOWN, onStartDrag); myMovieClip.addEventListener(MouseEvent.MOUSE_UP, onStopDrag);
function onStartDrag(evt:MouseEvent):void { evt.currentTarget.startDrag(); } function onStopDrag(evt:MouseEvent):void { evt.currentTarget.stopDrag(); }
|
|
|

|
stageEvents!
|
|
|

|
methods (aka functions--- more on this later)
|
|
|

|
DOES something
|
|
|

|
like: stop();
|
|
|

|
writing a function to change properties(demo)
|
|
|

|
frame and timer events.
|
|
|

|
a frame event is something that happens each time the flash player hits the keyframe containing the action.
|
|
|

|
faster faster!
|
|
|

|
week three
|
|
|

|
timer events: advantages
|
|
|

|
more consistent than frame events.
|
|
|

|
frame events are tied to the speed of the users computers. Timer events are measured in miliseconds
|
|
|

|
we will be using the prewritten Timer Class to make our timers.
|
|
|

|
the display list
|
|
|

|
addChild()
|
|
|

|
the display list is how AS3 manages all visual elements in your file.
|
|
|

|
THE OLD WAY
|
|
|

|
in AS 2, you had to add things dynamically by doing something like:
|
|
|

|
_root.createEmptyMovieClip("static_mc", 1);
|
|
|

|
this created a clip, loaded a movie into it and set the level
|
|
|

|
new way: addChild
|
|
|

|
addChil(mcName);
|
|
|

|
addChildAt();
|
|
|

|
AS 2: had to specify which level (like layers) you wanted things on
|
|
|

|
blank_mc.attachMovie("new_mc", "new", 999);
|
|
|

|
now AS3 adds them sequentially (can't skip layers). can specify which existing layer you want things on.
|
|
|

|
displayObject and displayObjectContainters
|
|
|

|
displayObject: anything (visual) that can be added to the display list
|
|
|

|
stage
|
|
|

|
movieClip
|
|
|

|
Sprite
|
|
|

|
textField
|
|
|

|
video
|
|
|

|
Interactive object
|
|
|

|
shape
|
|
|

|
displayObjectContainer: an object that can contain children:
|
|
|

|
/////////
|
|
|

|
removeChild
|
|
|

|
function onClick(evt:MouseEvent):void { if (numChildren > 0) { removeChildAt(0); } }
|
|
|

|
removeChild (null)
|
|
|

|
removeChild removes clips from the display list, but does not remove it
|
|
|

|
to do that , you need to "null" the removed clip
|
|
|

|
swapping depths
|
|
|