Programming 2
From ReThinkWiki
|
Topic Summary
- Additional beginning programming techniques using ActionScript such as if tests, looping and functions.
Topic Assignments
Update Code in Scuba Driver Game
1. Complete the Changing the Coding Within a Movie Clip in Scuba Diver Tutorial. Apply changes as directed and Create several versions with different behaviors.
2. Learn ActionScript basics with the following tutorials:
- Conditional Statements
- Switch() and Case Statements
- Loops
- Introduction to Functions
- Introducing ActionScript Objects
Wiki Update
- Upload the Flash SWF file to your wiki project page.
Related Links and Tutorials
Here are optional tutorials and activities you can do to learn more ActionScript Programming:
- Program Structure
- Working with Variables
- Comments in Actionscript
- Scripted Animation
- Scripted Sound
- Scripted Drawing
- Interface Controls
- Scripted Color
- Collision Detection
- Drag and Drop
- Making a Timer
Adobe's Tutorials
Actionscript.org
MyGLife.org Custom Tutorial
Notes and Comments
Variables
- One variable holds one thing
- Holds value
- Number, ground of letters(string)
- Address to a table, object
- Address to something such as a MovieClip or a button
- var <name>;
- ending will be type of thing it's holding(
- Example
- var healthAmount; //health of the player character
- var blueCowName; //name of the blue cow
- var deadAntCtr; //the number of ants player has stomped
- var ammoCount; //ammo for current weapon
- var currentWeaponName;
- var currentCharacterMC; //movie clip
- var rocketWeaponMC; //movie clip of the rocket weapon
- var bowArrowWeaponMC;
- var playerCharX; //is the x position of player character
- var playerCharY;
- var weaponsArray;
- Bad variable names
- 6*9 (no math operations)
- cow tail (no spaces)
- function (no reserved words used by flash)
- X!**&$* (no special characters other than
Assignment Statements
- carSpeed = 5;
- tempSpeed = carSpeed;
- baddieSpeed = tempSpeed + 5;
- carPos = carPos * carSpeed;
- carPosX++;
- carName = "Firecracker";
Conditionals (if test)
if (carSpeed > 10) {
carSpeed--;
} else {
carSpeed++;
}
Functions
- is a group of variables and program statements treated as a group
- variables created in a function are temporary and can't be accessed outside the function
- can have parameters passed to them to be worked on
function moveCar(speed) {
if (car._x + speed < Stage.width) {
car._x += speed;
}
}
Search the Web for more information
Here are some search results on Flash ActioScript programming:
- Google results for "actionscript & introduction & tutorial".
- YouTube results for "flash & programming & tutorial" .
- Ask.com results for "actionscript & introduction & tutorial".

