Thursday, September 1, 2011

Child loop

If you have a movie clip on the stage with multiple objects inside of it:
(for example a square movie clip named boxContainer with smaller squares inside)


for (var i:int = 0; i<boxContainer_mc.numChildren; i++) {
var thechild = boxContainer_mc.getChildAt(i);
trace (;

 If the parent has a property, for example a boolean property that you want to change,
sometimes it can't find which parent you are referring to so you have to tell it like this:
 nameParent(boxContainer_mc.getChildAt(i)).myProperty = true; 

In this example boxContainer holds a bunch of boxes. Boxes has a boolen property (inside the file):
public var myProperty:Boolean = false;  
In the main file:
Boxes(boxContainer_mc.getChildAt(i)).myPropery = true; 

Thursday, August 25, 2011

Thursday, August 18, 2011

My Game

This is a 1 player game that could be expanded into a multi player game.

You are an explorer stranded on a strange island. You must gather 3 treasures and escape from the island.

There is a grid-based playing field made up of tiles. Each tile may have a hidden treasure or have an important resource.  On one side of the field on top of one of the tiles is a vicious beast-monster (bad guy). On the opposite side of the field is the player.  The goal is to meet the win condition before the bad buy meets any number of various conditions (“bad guy” win conditions). The player is allowed to take 3 actions per turn.

Game Play:
The player takes a turn and then bad guy does his turn. If there are multiple players the bad guy takes a turn after every player turn.

Actions the bad guy might take:
Move a tile.
Make minions.
Destroy something.

Bad Guy Win Conditions:
The bad guy lands on the same tile as the player.
The bad guy overwhelms the grid with his minions.
The bad guy destroys your escape vessel.

Player actions:
Move 1 Space
Dig for treasure.
Build something (if they have enough resources)
Destroy and enemy minion.

Player(s) Win Condition:
The player(s) find at least 3 treasures and builds a boat make it off the island. If there are multiple players a bigger boat must be built.

The player has a meter that shows their total resource/money score. The meter increases when they find more resources either by uncovering them.

Thursday, August 11, 2011

In Class Notes

Pimp My Ride: They take a crappy car and make it fancy.
Instead of building a whole car from scratch they inherit a Nissan Sentra and extend it to look differently by changing it's properties.

It is still the same Nissan Sentra.

Composition is an alternative to inheritance.
This is like taking the Nissan Sentra and attaching another gadget, like a popcorn machine or huge cinema display. Making the 2 pieces work together, but they do not share any properties. You are composing the 2 pieces together.

Allows objects of different classes to have the same method but behave differently.
On the Nissan Sentra when you turn on the lights that is a functionality of the car, but that method can turn on the headlights and turn on a disco ball. So "turnOn" can result in different things being turned on.

Thursday, August 4, 2011

Numbered Styled code

Notes from the Reading

Classes collect related functions (methods), variables (properties), and other relevant items.

Document Class
allows you to create a custom class that can be used as a type of timeline

1:  package {  
2:  import flash.display.MovieClip;  
3:  public class Main extends MovieClip {  
4:  public function Main() {  
5:  trace("Flash");  
6:  }  
7:  }  
8:  }  

To use a class in a
specific subdirectory, you need to import the class, including the classpath
import flash.display.MovieClip;
import myapp.effects.Water;

package myapp.effects {
public class Water {
public function Water() {


Composition says that an object can be composed of other objects, rather
than descend from other objects.


Knowing when to opt for an object-oriented model depends largely on
understanding the benefits of OOP, among them:

Classes. Classes are collections of related functions and variables gathered
to facilitate one or more specific goals. They are the foundation of
OOP, and we’ll look at a few ways to use them.

Inheritance. Inheritance is one of OOP’s greatest sources of power, as it
allows you to add functionality to an existing feature set without reinventing
the wheel, as the saying goes. Being able to extend an existing class to
create a subclass, rather than originating an entirely new class, can save
you a significant amount of time and labor, as well as improve project

Composition. Inheritance isn’t appropriate for every situation, and composition
is often a useful alternative. Composition is a technique somewhat
akin to collecting related classes, much like classes collect related
functions and variables. The classes do not inherit characteristics from
one another, but are made to work together in productive ways.

Encapsulation. It’s usually not a good idea to expose all aspects of a class
to other classes or the surrounding application. Encapsulation isolates
most elements of a class from the outside world, allowing only a select
few elements, if any, to be seen by structures that use the class.

Polymorphism. Polymorphism allows objects of different classes to have,
through a unified interface design, methods that have the same name but
that behave differently when invoked. By using polymorphism, you can
reduce the number of methods that must be documented and learned,
and, more importantly, make it easier to extend classes. New subclasses
can use an existing method name but return a result appropriate to the
new class.

To get started you open: 
ActionScript Class.
You name it with a capital letter.
For example: Main
Save it.

Next you open a regular action script file.
Save it in the same folder as your
Then in the properties panel you give it a class of Main.

For a document class you have to give it a timeline. 

package  {
    import flash.display.MovieClip;
    public class Main  extends MovieClip {  //you dont have to extend from something, but we are using a document class.
                                              //you have to extend a mc with the document class because we need a timeline
                                            //if you were making a sprite for example you do need a timeline

        public function Main() {
            // constructor code
            trace("hello world");


And then a bunch of shit happened that I should probably have notes on.